Assign Value to PDF
Verb: pdfSetValue
Available from: <Standard>
Assigns a value to a specific field in a editable PDF file.
Syntax
pdfSetValue --value(String) --field(String) --file(Pdf)
Inputs
Script | Designer | Required | AcceptedTypes | 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 file that should be manipulated. |
Example
The Assign Value to PDF command assigns the field "Name" of a specific PDF file the value "User". Using the Get PDF Field 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
Download File
For the correct operation of the script above, it is necessary to download the file and enter its path in the Path parameter of the Open PDF File command.
Remarks
To accurately obtain the name of the field to which the value should be assigned, the "Field Mapper" function may be used. It is available at the top of the Assign Value to PDF command window and in the IBM RPA Studio menu under "Tools> Pdf> Field Mapper".