Close PDF

Closes a PDF file allowing the user to choose whether to save it in a specified directory or not.

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.

pdfClose [--save(Boolean)] --filename(String) [--flatten(Boolean)] --file(Pdf)

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
Save save Optional Boolean Enable to save all modifications made to the PDF file.
File filename Only whenSave is True Text Full path to the location where the PDF file should be saved. This path contains the file name and its extension.
Freeze forms flatten Optional Boolean Enable it to block editable fields of the PDF file, turning them into text fields only.
PDF file Required PDF Variable that holds the PDF file.

Example

Closes without saving any changes a ".pdf" file.

defVar --name PDFFile --type Pdf
defVar --name PDFDirectory --type String
defVar --name obtainedText --type String
// Download the file "fileForPDFCommands.pdf" to execute the command.
pdfOpen --file "fileForPDFCommands.pdf" PDFFile=value PDFDirectory=file
pdfText --file ${PDFFile} obtainedText=value
// Closes the open PDF file.
pdfClose --file ${PDFFile}

Important: To run the sample script, you must use the path to a PDF file in the Path parameter of the Open PDF File command.