I am trying to find a very quick way to determine if a PDF file is Encrypted. It appears that the text "/Encrypt" is in all encrypted PDF files.
If the result of this script is greater than one the PDF is Encrypted
ReadFile>c:\test\ecntest.pdf,file
Position>/Encrypt ,%file%,1,StartPos
MDL>%StartPos%
However, it takes time to process it. If I open the PDF in Notepad search for /Encrypt it is instant. With the above script I have to wait. I realize why I am waiting as the nature of the search has to check every possible combination and keep track of the results.
I tested how fast it reads the file and that is instant, it is the search that is slowing it down.
Does anyone know if there is a quicker way to do this?
The nature of the script is to process PDF files and if they are encrypted they cannont be processed. An encrypted one would be a rare occasion so this is just for error traping, and slowing it down this much for the rare error is a hard call, but then I look at the user base and well - I think I need to find a quicker way.