Get PDF Field
Verb: pdfGetValue
Available from: <Standard>
Gets the value of a specific field in an editable PDF file.
Syntax
pdfGetValue --field(String) --file(Pdf) (Scalar)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--field | Field | Required | Text | Name of the field from which the value should be obtained. |
--file | Required | PDF file that should be manipulated. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Value | Primitives | Returns the value obtained from the field specified in the Get PDF Field parameter. |
Example
The Get PDF Field command gets the value "User" from the field "Given Name Text Box" of a specific PDF file. The use of the Assign Value to PDF command, as a form of demonstration, helps to assign the value to the field before obtaining it.
defVar --name pdfFile --type Pdf
defVar --name fieldValue --type String
// Download the following file to run the command.
pdfOpen --file "fileForPDFCommands_editable.pdf" pdfFile=value
pdfSetValue --value User --field "Given Name Text Box" --file ${pdfFile}
// Get field value after assigning value.
pdfGetValue --field "Given Name Text Box" --file ${pdfFile} fieldValue=value
logMessage --message "Text assigned and obtained from the field \"Given Name:\": ${fieldValue}" --type "Info"
// Returns the following output in the console:
// Text assigned and obtained from the "Given Name:" field: User.
Download File
For the correct operation of the above script, it is necessary to download the file and insert its path in the Path parameter of the Open PDF File command.
Remarks
To accurately check the name of the field from which the value is obtained, it is possible to use the "Field Mapper" function, which is available at the top of the command window Get PDF Field, and also in the IBM RPA Studio menu, under "Tools> Pdf> Field Mapper".