Issue with PDF which is protected with password

pdf
activities

#1

Scenario: I have pdf file(odf contains password) which i can access it using read pdf activity i can see on output on console panel but if i remove password from read pdf i didn’t got any output(output was empty) which is expected but how to catch this kind of exception, i have also tried with try catch but no luck


#2

Hi,
Getting empty result is not part of exception(unless its null reference) hence Try/Catches won’t be helpful here.
You can simply use in if condition ( result=null/empty) then proceed according.


#3

Hey @ddpadil,
Even i tried that too. We cant use result=null//empty , it was showing some error, so i tried with IsDBnull it works. actual problem i want to check whether my file is protected with password or not ?


#4

Oh got it.
First you need to download Windows.Data.Pdf dll and import to studio.
Windows.Data.Pdf class support following methods:
Then you can check using bool IsPasswordValid or CheckPdfProtection or simply using IsOpenedWithFullPermissions

For the reference:


#5

importing to studio in the sence , have downloaded and copied that dll in c://users/…uipath/ but couldnt see windows.data.pdf to add to studio. or i need to follow create custom activity ?


#6

Yep.