获取条形码
动词:getBarcode
可从以下位置获取: <Enterprise>
从图像或 PDF 文件获取一个或多个条形码。
语法
getBarcode --sourcetype(BarcodeSourceType) --image(Image) --pdf(Pdf) --pdfpage(Numeric) [--codepositionfrom(Boolean)] --codeposition(Numeric) --format(Nullable<BarcodeFormat>) [--retry(Boolean)] --step(Numeric) --max(Numeric) (DataTable)=table (String)=code (String)=type (Boolean)=success
输入
| 脚本 | 设计器 | 必需的 | AcceptedTypes | 描述 |
|---|---|---|---|---|
| --sourcetype | 源 | 必需的 | BarcodeSourceType | 条形码所在的文件的类型。 选项: |
| --image | 图像 | 仅当“源”为“图像”时 | 图像、文本 | 包含条形码的图像文件。 |
| 仅当“源”为 Pdf 时 | PDF、文本 | 包含条形码的 PDF 文件。 | ||
| --pdfpage | 要读取的页面 | 仅当“源”为 Pdf 时 | 成员 | 包含条形码的 PDF 文件的页码。 |
| --codepositionfrom | 条形码位置 | 可选 | BOOLEAN | 启用后,将允许根据文件中代码排列的顺序选择条形码位置。 |
| --codeposition | 条形码位置顺序 | 仅当“条形码位置”为 True 时 | 成员 | 条形码所在的位置。 |
| --format | 格式 | 必需的 | BarcodeFormat | 条形码类型。 |
| --retry | 重试 | 可选 | BOOLEAN | 启用后,如果第一次尝试未获得条形码,那么重复执行命令。 |
| --step | 步骤 | 仅当“重试”为 True 时 | 成员 | 每次尝试应用于条形码的缩放百分比。 |
| --max | 最大缩放量 | 仅当“重试”为 True 时 | 成员 | 重试后可以应用的最大缩放。 |
| --fromfile | 从文件获取(已废弃) | 可选 | BOOLEAN | 启用后,定义文件将提供条形码。此参数已废弃,请改为使用源参数。 |
| --imagepath | 图像路径(已废弃) | 仅当“从文件获取”为 True 时 | 文本 | 包含条形码的文件的图像路径。此参数已废弃,请改为使用源参数。 |
| --frompdf | 从 PDF 获取(已废弃) | 可选 | BOOLEAN | 启用后,定义 PDF 文件将提供条形码。 |
输出
| 脚本 | 设计器 | AcceptedTypes | 描述 |
|---|---|---|---|
| 表 | 代码和类型的列表 | 数据表 | 返回每个条形码的值及其类型的列表。 |
| 代码 | 图像代码 | 文本 | 返回根据位置获得的条形码。 |
| 类型 | 条形码类型 | 文本 | 返回根据位置获得的条形码类型。 |
| 成功 | 成功 | BOOLEAN | 如果执行获得条形码,那么返回“True”;如果未获得,那么返回“False”。 |
示例
使用获取条形码命令,根据在格式参数中定义的类型获取条形码。
defVar --name codes --type DataTable
defVar --name imageCode --type String
defVar --name codeType --type String
defVar --name success --type Boolean
//Download the file below to test the script.
getBarcode --sourcetype "Image" --image "QRCodeImage.png" --format "QR_CODE" imageCode=code codeType=type codes=table success=success
//Displays in the console the value of each barcode obtained and its type.
logMessage --message "\r\n${codes}\r\n${imageCode}\r\n${success}\r\n${codeType}" --type "Info"
要执行以上脚本,您需要下载上述文件,并在图像参数中插入保存此文件的路径。
备注
在步骤参数中插入的值(在第一次执行命令时添加到已经存在的缩放中)必须小于在最大缩放参数中输入的值。