向 PDF 赋值
为可编辑 PDF 文件中的特定字段赋值。
命令可用性: 本地 IBM RPA SaaS 和 IBM RPA
脚本语法
IBM RPA 的专有脚本语言的语法与其他编程语言类似。 该脚本语法在脚本文件中定义命令的语法。 您可以在 IBM RPA Studio的 脚本 方式下使用此语法。
pdfSetValue --value(String) --field(String) --file(Pdf)
输入参数
下表显示了此命令中提供的输入参数的列表。 在表中,您可以看到在 IBM RPA Studio的脚本方式及其 Designer 方式等效标签中工作时的参数名称。
| 设计器方式标签 | 脚本方式名称 | 必需的 | 接受的变量类型 | 描述 |
|---|---|---|---|---|
| 值 | value |
Required |
Text |
在字段参数中为指定字段赋的值。 |
| 字段 | field |
Required |
Text |
为其赋值的字段的名称。 |
file |
Required |
PDF |
应处理的 PDF 文件。 |
示例
此命令将特定 PDF 文件的字段 "Name" 指定为值 "User"。 使用 Get PDF Field (pdfGetValue) 命令返回分配给该字段的值作为演示。
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
❕ 重要信息: 要运行样本脚本,必须使用命令 打开 PDF 文件 的 Path 参数中 PDF 文件的路径,并使用命令的 Field 参数中 PDF 文件的字段名称。