如何指定文本框以通过API / SDK在PDF上签名? [英] How to Specify Text Box to Sign on PDF via API/SDK?

查看:200
本文介绍了如何指定文本框以通过API / SDK在PDF上签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PDF的白色背景文本框上有白色文本。该文本框中的文本设置为 < signature> 。这是我要签名人签名的PDF区域。



请注意,这不是文本字段,而是文本框。它们在Adobe PDF中是不同的东西。一方面,文本框仅包含文本,没有像字段一样的实际字段名称。



不需要此文本框的X和Y坐标。我不想使用DocuSign模板。我确实想使用我们的预定义文本框。我确实想完全使用API​​ / SDK定义签名区域,并将其与我的文本框相关联。



这是我尝试过的:



我正在使用SDK中的eSign模型。我实例化了一个新的DocuSign.eSign.Model.SignHere对象。我是否需要以某种方式将此处的标志选项卡与PDF上的文本框相关联?我尝试过分别设置每个属性(如下所示),但没有获得预期的结果。同样,我想将DocuSign.eSign.Model.SignHere选项卡与我的PDF上预定义的文本框相关联。

  var SignHereTab = new DocuSign.eSign.Model.SignHere(); 
SignHereTab.TabId =< signature>;
SignHereTab.Name =< signature>;
SignHereTab.AnchorCaseSensitive =< signature>;
SignHereTab.CustomTabId =< signature>;

或者,我会把这全部弄错吗?如果无法使用TEXT BOX进行此操作,可以使用TEXT FIELD进行吗?如果最好使用FIELD,我应该使用什么代码将此处签名标签与字段相关联?再次,我宁愿不使用X / Y或模板。

解决方案

我是否正确理解这就是您想要的




  • 使用API​​创建信封,并将您指定的PDF作为文档

  • 根据PDF中字符串< signature> 出现的位置,在文档中自动放置 SignHere 标签



如果是这种情况,则需要使用DocuSign所指的锚文本- -这是一个字符串,在文档中以普通文本形式存在(即,不是 在文本框中,而是页面上的普通文本)。


I have a white-text on a white-background text box on a PDF. The text in that text box is set to "<signature>". This is the area on the PDF that I want a signer's signature to go.

Please note, this is not a TEXT FIELD, but is a TEXT BOX. They're different things in Adobe PDF. For one thing, text boxes only have text and don't have actual field names like fields do.

I don't want to specific X and Y coordinates of this textbox. I don't want to use a DocuSign template. I do want to use our pre-defined text box. I do want to define the signature area entirely using the API/SDK, associating it to my text box.

This is what I've tried:

I'm using the eSign model from the SDK. I instantiated a new DocuSign.eSign.Model.SignHere object. Do I need to associate that sign here tab somehow to my text box on the PDF? I've tried setting each of the properties seperately (like below), but did not get the result I expected. Again, I want to associate a DocuSign.eSign.Model.SignHere tab with a pre-defined textbox on my PDF called.

var SignHereTab = new DocuSign.eSign.Model.SignHere();
SignHereTab.TabId = "<signature>";
SignHereTab.Name = "<signature>";
SignHereTab.AnchorCaseSensitive = "<signature>";
SignHereTab.CustomTabId = "<signature>";

Or, am I going about this all wrong? If I can't do this with a TEXT BOX, can I do it with TEXT FIELD? If it's better to use a FIELD, what code do I use to associate a sign here tab with a field? Again, I'd rather not use X/Y or Templates.

解决方案

Do I understand correctly that this is what you want to accomplish?

  • Use the API to create an Envelope, with the PDF you specify as the document
  • Have a SignHere tab automatically placed in the document based on where the string <signature> appears in the PDF

If that's the case, then you'll want to use what DocuSign refers to as anchor text -- this is a string that exists in the document as normal text (i.e.,, not within a text box, but rather, as normal text on the page). The "Get the Document to be Signed" section of this page provides a description of how to use anchor text (and even provides a sample doc that contains anchor text). An excerpt from that page:

Open Mutual_NDA.pdf in a PDF viewer. Search for the strings "signer1name", "signer1sig", and "signer1date". You’ll notice that the search matches but that the text is not visible. These strings are regular text in the document. Their text color has been set to white, so they can’t be see in the document. But DocuSign can find them, and use them as anchor text to place the tabs (the signature, name, and date fields).

So, simply add the text string <signature> as white text (on white background) within your PDF. Then when specifying the SignHere tab in the "Create Envelope" API request, set the following properties for that tab:

"recipients": {
    "signers": [
        {
            "roleName": "Signer1",
            "recipientId": "1",
            "name": "John Doe",
            "email": "johnDoe@test.com",
            "tabs": {
                "signHereTabs": [
                    {
                        "anchorString": "<signature>",
                        "anchorIgnoreIfNotPresent": true,
                        "documentId": "1", 
                        "optional": false, 
                        "tabLabel": "Signature"
                    }
                ]
            }
        }
    ]
}

When used within a "Create Envelope" request (POST https://{{env}}.docusign.net/restapi//v2/accounts/{{accountId}}/envelopes), the JSON above will result in a (required) SignHere tab being automatically placed for recipient John Doe anywhere that the string <signature> appears in the document.

(I'm not very familiar with the node SDK, but I imagine that knowing what properties need to be set will get you going in the right direction.)


UPDATE #1


If it's important that the signature appear inside a textbox on the PDF, you can still accomplish this using anchor text. For example, simply place the anchor text string (ex: ) in the PDF just below the textbox where you want the signature tag to appear, the specify the anchorYOffset property and the anchorUnits property to tell DocuSign where you want the signature tab to appear relative to the position of the anchor string. In that example, here's the structure of the signature tab in the API request:

"signHereTabs": [
    {
        "anchorString": "<signature>",
        "anchorXOffset": "0", 
        "anchorYOffset": "-10",
        "anchorUnits": "pixels",
        "anchorIgnoreIfNotPresent": true,
        "documentId": "1", 
        "optional": false, 
        "tabLabel": "Signature"
    }
]

Finally (for your reference), here's the full list of the tab properties related to anchor strings:

这篇关于如何指定文本框以通过API / SDK在PDF上签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆