带有表单字段的 PDF 文档的嵌入式签名
Embedded Signing of PDF Document with Form Fields
我目前处理的场景如下:
我们有一个应用程序可以使用用户数据(比如姓名、地址等)预填充 PDF 文档的大部分表单字段。
此外,还有一些表单字段已根据以下指定的详细信息命名:https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Document%20Parameters.htm#Transfor
例如,其中一个表单字段可能命名为 "first_name" 并填充值 "John",而另一个字段为空并命名为 "eSignSignHere"(用于DocuSign 签名)。
创建信封时,JSON 有效载荷类似于以下内容,通过 HTTP POST 作为多部分请求提交到 [baseUrl]/envelopes
,包括 PDF。
{
"emailSubject": "Test PDF Field Transform",
"documents": [
{
"documentId": 1,
"name": "fillable-form.pdf",
"transformPdfFields": "true"
}
],
"recipients": {
"signers": [
{
"email": "email@email.com",
"name": "John Smith",
"recipientId": "1234",
"clientUserId": "1234",
"defaultRecipient": "true"
}
]
},
"status": "sent"
}
正如预期的那样,作为响应,我收到了一个信封 ID 和 URI。
然而,当通过 ID 获取信封时(使用 [baseUrl]/envelopes/[envelopeId]/views/recipient
),我看到了自由格式签名视图,其中显示了 none 个字段,而不是字段工具箱,允许用户将字段和签名放在他们喜欢的地方。
最终,我想要与通过 Web 控制台上传文档时发生的行为相同,选择 "Assign fields"。
是否可以这样做,或者这是将文档上传到自由格式签名时的唯一选择?如果是后者,transformPdfFields 属性 在这种情况下的目的是什么?
经过更多搜索,我偶然发现了 Docusign Transform Pdf Fields For single recipient?。
稍微改变原始的 JSON 负载,得到了我想要的结果。
与 PDF 文档一起在多部分请求中提交的调整后 JSON 现在是:
{
"emailSubject": "Test PDF Field Transform",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": 1,
"recipients": {
"signers": [
{
"email": "email@email.com",
"name": "John Smith",
"recipientId": "1234",
"clientUserId": "1234",
"defaultRecipient": "true"
}
]
}
}
],
"document": {
"documentId": 1,
"name": "fillable-form.pdf",
"transformPdfFields": "true"
}
}
],
"status": "sent"
}
为了显示转换后的 PDF 字段,而不是自由格式模式 – 这按预期工作。
我目前处理的场景如下:
我们有一个应用程序可以使用用户数据(比如姓名、地址等)预填充 PDF 文档的大部分表单字段。
此外,还有一些表单字段已根据以下指定的详细信息命名:https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Document%20Parameters.htm#Transfor
例如,其中一个表单字段可能命名为 "first_name" 并填充值 "John",而另一个字段为空并命名为 "eSignSignHere"(用于DocuSign 签名)。
创建信封时,JSON 有效载荷类似于以下内容,通过 HTTP POST 作为多部分请求提交到 [baseUrl]/envelopes
,包括 PDF。
{
"emailSubject": "Test PDF Field Transform",
"documents": [
{
"documentId": 1,
"name": "fillable-form.pdf",
"transformPdfFields": "true"
}
],
"recipients": {
"signers": [
{
"email": "email@email.com",
"name": "John Smith",
"recipientId": "1234",
"clientUserId": "1234",
"defaultRecipient": "true"
}
]
},
"status": "sent"
}
正如预期的那样,作为响应,我收到了一个信封 ID 和 URI。
然而,当通过 ID 获取信封时(使用 [baseUrl]/envelopes/[envelopeId]/views/recipient
),我看到了自由格式签名视图,其中显示了 none 个字段,而不是字段工具箱,允许用户将字段和签名放在他们喜欢的地方。
最终,我想要与通过 Web 控制台上传文档时发生的行为相同,选择 "Assign fields"。
是否可以这样做,或者这是将文档上传到自由格式签名时的唯一选择?如果是后者,transformPdfFields 属性 在这种情况下的目的是什么?
经过更多搜索,我偶然发现了 Docusign Transform Pdf Fields For single recipient?。
稍微改变原始的 JSON 负载,得到了我想要的结果。 与 PDF 文档一起在多部分请求中提交的调整后 JSON 现在是:
{
"emailSubject": "Test PDF Field Transform",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": 1,
"recipients": {
"signers": [
{
"email": "email@email.com",
"name": "John Smith",
"recipientId": "1234",
"clientUserId": "1234",
"defaultRecipient": "true"
}
]
}
}
],
"document": {
"documentId": 1,
"name": "fillable-form.pdf",
"transformPdfFields": "true"
}
}
],
"status": "sent"
}
为了显示转换后的 PDF 字段,而不是自由格式模式 – 这按预期工作。