Assign Value to PDF
Assigns a value to a specific field in a editable PDF file.
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.
pdfSetValue --value(String) --field(String) --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 |
---|---|---|---|---|
Value | value |
Required |
Text |
Value assigned to the specified field in the Field parameter. |
Field | field |
Required |
Text |
Name of the field to which the value is assigned. |
file |
Required |
PDF |
PDF file that should be manipulated. |
Example
This command assigns the field "Name" of a specific PDF file the value "User". Using the Get PDF Field (pdfGetValue
) command returns the value assigned to the field
as a demonstration.
defVar --name pdfFile --type Pdf
defVar --name pdfDirectory --type String
defVar --name fieldValue --type String
// Download the following file to execute the command.
pdfOpen --file "fileForPDFCommandsEditable.pdf" pdfFile=value pdfDirectory=file
pdfSetValue --value User --field "Given Name Text Box" --file ${pdfFile}
// Get the value of the field after assigning value.
pdfGetValue --field "Given Name Text Box" --file ${pdfFile} fieldValue=value
logMessage --message "Text assigned and obtained from field \"Name\": ${fieldValue}" --type "Info"
// Text assigned and obtained from "Name:" field: User
❕ Important: To run the sample script, you must use the path to a PDF file in the Path parameter of the command Open PDF File and use the name of the field of the PDF file in the Field parameter of the command.