Skip PDF Files that are password protected

Hello again,

I have a short question - i have a large number of PDF files that i want to read and use the information inside them. The only problem being that some of those files are password protected and i want to skip them.

Is there any way to check if they need a password and if the password is needed, to skip the files entirely?

Any suggestion is welcomed.

Thank you,
Cristi

Hi @Cristian_Ionita I think you may use a Try Catch block when attempting to read each PDF file.

Hi @Cristian_Ionita

Please implement the logic as same in the below thread in Uipath

As @dokumentor mentioned, use Try-Catch to met your requirement.

Hope this will be helpful. Thank you.

Here is an screenshot. If you are using Read PDF Text activity you can catch IncorrectPasswordException this way:

image

Hi,

Use Simple VB code to check whether the PDF is encrypted or not by using isencrypted function. we can use invoke code activity and the output should be Boolean so that we can use if condition and ignore the PDF’s are protected. please refer the below ink for more guidance. thanks.

https://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Security/How-to-detect-if-a-PDF-document-is-password-protected-in-C-VB.NET.html

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.