Skip to main content
April 15, 2026
Question

How to find out if any PDF file is encrypted or not

  • April 15, 2026
  • 15 replies
  • 0 views

Hello

I have a requirement to read text from PDF so we have used getpdftext but if the user uploads password protected PDF file , the function getpdftext is throwing the below error-

Expression evaluation error at function 'getpdftext': Cannot decrypt PDF, the password is incorrect

If the file is password protected, I need to by pass the flow which is going to getpdftext, So Before only I need to check if the file is password protected or NOT. Can any one please suggest how to achieve this.

15 replies

mikes0011
Brainy
April 15, 2026

There's an old archived plugin that looks like it had this capability, unfortunately it's no longer available (since maybe 10 years ago).  Otherwise I know of no other ways to try() doing this.  At least without using unsupported functions ;-)

May 1, 2026

There is another plugin you could use - Document Page Counter and its "getnumberofpages" function.
While it doesn't actually tell you a pdf is password-protected, it will return a value of 0 for the page count, and, more importantly, won't throw an error.

Mike's very subtle suggestion would give a more positive answer, but this plugin would at least avoid any unsupported concerns...

mikes0011
Brainy
May 1, 2026
While it doesn't actually tell you a pdf is password-protected, it will return a value of 0 for the page count

hm, that makes me wonder whether we could make use of functions like "getPdfFields" in a similar way - for instance I assume it would return something unusable (hopefully not a hard-stop error) when the PDF it's fed is protected.  I don't know if I have a protected PDF on-hand to try with, though.

May 1, 2026

Thanks, Mike, for your message. Unfortunately, none of the PDFTool functions work with encrypted files. We already tried earlier using functions like “getPdfFields” and “getPdfMetaData”, but they returned an error stating, “cannot decrypt PDF, password is incorrect”.

harshas2775
May 2, 2026

You can explore and use any of the below plugins which includes function  isPasswordProtected()&  isPDFPasswordProtected() respectively to validate whether file is password protected or not. 

 [mention:126b105feac54dd29d6ab138b6a4d937:f7d226abd59f475c9d224a79e3f0ec07] 

 [mention:1b3e1331ba6f4c308ce0150b4807dfb9:f7d226abd59f475c9d224a79e3f0ec07] 

May 2, 2026
Thank you for your input. At this time, we are looking for Appian-supported plugins, as per the client’s guidelines and recommendations.