Decrypt PDF File

Decrypts a PDF file using the owner's password.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

decryptPdf --file(String) --ownerpassword(String) (Boolean)=success (Pdf)=value

Input parameter

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
PDF file Required Text, PDF Full path to the PDF file, or a variable containing the file.
Owner password ownerpassword Required Text Password that gives full access to the file.

Output parameter

Designer mode label Script mode name Accepted variable types Description
Success success Boolean Returns True if the file was decrypted, or False otherwise.
Decrypted PDF value PDF Returns the decrypted PDF file.

Example

Takes an image from a website and saves it in an encrypted PDF file, then decrypts the file allowing all kinds of interaction.

defVar --name desktop --type String
defVar --name pdfFile --type Pdf
defVar --name successEncrypt --type Boolean
defVar --name encryptPdf --type Pdf
defVar --name successDecrypt --type Boolean
defVar --name decryptPdf --type Pdf
getSpecialFolder --folder "Desktop" desktop=value
webStart --name browser --type "Chrome"
webNavigate --url "https://www.ibm.com/"
webCapture --format "Pdf" --savedirectory "${desktop}" --filename Encrypt
webClose --name browser
pdfOpen --file "${desktop}\\Encrypt.pdf" pdfFile=value
encryptPdf --file "${pdfFile}" --method "Aes256" --ownerpassword "automation@123" --userpassword wdgclient --printing "HighQuality" --dataextraction "NotAllowed" --modification "Allowed" --interactivity "Allowed" successEncrypt=success encryptPdf=value
logMessage --message "Success Encrypt: ${successEncrypt}" --type "Info"
decryptPdf --file "${encryptPdf}" --ownerpassword "automation@123" successDecrypt=success decryptPdf=value
logMessage --message "Success decrypt: ${successDecrypt}" --type "Info"