Encrypt PDF File
Encrypts a PDF file, according to the chosen encryption method.
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.
encryptPdf --file(String) --method(Nullable<PdfEncryptionMethod>) --ownerpassword(String) [--userpassword(String)] --printing(Nullable<PdfPrintingPermissions>) --dataextraction(Nullable<PdfDataExtractionPermissions>) --modification(Nullable<PdfModificationPermissions>) --interactivity(Nullable<PdfInteractivityPermissions>) (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 |
---|---|---|---|---|
file |
Required |
Text , PDF |
Full path to the PDF file, or a variable containing the file. | |
Method | method |
Required |
PdfEncryptionMethod |
Encryption method. See the method options. |
Owner password | ownerpassword |
Required |
Text |
Password that gives full access to the file. |
User password | userpassword |
Optional |
Text |
Pasword that gives limited access to the file according to the defined restrictions. |
Printing | printing |
Required |
PdfPrintingPermissions |
Print modes available to those using the User password parameter. See the printing options. |
Extract data | dataextraction |
Required |
PdfDataExtractionPermissions |
Release levels for extracting data from the file allowed to those using the User password parameter. See the dataextraction options. |
Modification | modification |
Required |
PdfModificationPermissions |
Types of modifications released to those using the User password parameter. See the modification options. |
Interactivity | interactivity |
Required |
PdfInteractivityPermissions |
Interactivity levels allowed for those using the User password parameter. See the interactivity options. |
method
parameter options
The following table displays the options available for the method
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Aes128 | Aes128 |
AES 128-bit Encryption. |
Aes256 | Aes256 |
AES 256-bit Encryption. |
Arc4 | Arc4 |
ARC4 Encryption. |
printing
parameter options
The following table displays the options available for the printing
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name |
---|---|
High quality | HighQuality |
Low quality | LowQuality |
Not allowed | NotAllowed |
dataextraction
parameter options
The following table displays the options available for the dataextraction
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name |
---|---|
Accessibility | Accessibility |
Allowed | Allowed |
Not allowed | NotAllowed |
modification
parameter options
The following table displays the options available for the modification
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name |
---|---|
Document assembling | DocumentAssembling |
Allowed | Allowed |
Not allowed | NotAllowed |
interactivity
parameter options
The following table displays the options available for the interactivity
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name |
---|---|
Form filling and signing | FormFillingAndSigning |
Allowed | Allowed |
Not allowed | NotAllowed |
Output parameter
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Success | success |
Boolean |
Returns True if the file was encrypted, or False otherwise. |
Encrypted PDF | value |
PDF |
The encrypted PDF file. |
Example
Get an image of a web page, save it as a PDF, encrypt the file and return the information if the encryption was successful.
defVar --name pdfFile --type Pdf
defVar --name successEncrypt --type Boolean
defVar --name encryptPdf --type Pdf
defVar --name desktop --type String
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 "Allowed" --modification "Allowed" --interactivity "Allowed" successEncrypt=success encryptPdf=value
logMessage --message "Success Encrypt: ${successEncrypt}" --type "Info"