XFA PDF 将数据填充到重复的字段 ID 中

问题描述 投票:0回答:1

使用库 pdf.js

IRCC XFA 参考:https://www.canada.ca/content/dam/ircc/migration/ircc/english/pdf/kits/forms/imm5257b_1.pdf

在此 XFA 表单中,多个控件的 fieldid 和 dataid 值是重复的。例如。

familyname

例如:

{ 
        "name": "textarea", 
        "attributes": { 
            "dataId": "field284442", 
            "fieldId": "field284442", 
            "class": [ 
                "xfaTextfield" 
            ], 
            "aria-label": "Question 1 Family name as shown on your passport or travel document", 
            "aria-required": true, 
            "required": true, 
            "tabindex": 5002, 
            "maxLength": 100 
        } 
    } 
}

https://prnt.sc/Mxel9q-YRrUE

https://prnt.sc/KQse9WsR_3Y8

问题:如果我想用值

field284442
更新
{john}
,由于 id 重复,代码将无法工作。

pdf.annotationStorage.setValue('field284442', { value: 'John' }); 

你能帮我吗:

  1. 如果有的话我们可以避免重复;并更新文本控件以设置值?
  2. 有什么方法可以让我们遍历到特定的子节点并设置值吗?

任何示例代码、解决方案链接或输入都将受到高度赞赏。
预先感谢。

pdf npm jspdf pdf.js
1个回答
0
投票

您是否成功完成了pdf的填写和保存?谢

© www.soinside.com 2019 - 2024. All rights reserved.