c# - DocuSign 自动放置( anchor 标记)返回选项卡放置在页面之外 c#

标签 c# docusignapi

我正在使用 Docusign 在 C# 中向我的 PDF 文档添加签名。

我将此带有 Id、class 和文本“SignHereLastPage”的标签添加到我的 html 页面末尾。然后我将其转换为 2 页 PDF 文件。

 <!DOCTYPE html>
    <html xmlns='http://www.w3.org/1999/xhtml'>
    <body>
    Some html.....

     //add in the end
    <div class='RightToLeft Signature Bold'>  Sing__________________ </div>
    <label id='SignHereLastPage' class='SignHereLastPage'style='color:white'>SignHereLastPage</label>
    </body>
    </html>

如果我将signHere.PageNumber设置为2,并添加x/y位置一切正常,但我想使用我的textValue自动添加此符号区域。

我的代码:

   Signer signer = new Signer();
   signer.Email = Email;
   signer.Name = signerName + LeadName;
   signer.RecipientId = signerRecipientId;
   signer.Tabs = new Tabs();
   signer.Tabs.SignHereTabs = new List<SignHere>();
   SignHere signHere = new SignHere();
   signHere.AnchorString = "SignHereLastPage";//here my text in html
   signHere.AnchorXOffset = "1";
   signHere.AnchorYOffset = "0";
   signHere.AnchorIgnoreIfNotPresent = "false";
   signHere.AnchorUnits = "inches";
   signer.Tabs.SignHereTabs.Add(signHere);

   envDef.Recipients = new Recipients();
   envDef.Recipients.Signers = new List<Signer>();
   envDef.Recipients.Signers.Add(signer);
   envDef.Status = "sent";

   ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");

  DocuSign.eSign.Client.Configuration cfi = new     DocuSign.eSign.Client.Configuration(apiClient);
    string authHeader = "{\"Username\":\"" + x+ "\", \"Password\":\"" + xx+ "\", \"IntegratorKey\":\"" + xxx+ "\"}";
cfi.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
EnvelopesApi envelopesApi = new EnvelopesApi(cfi);
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountID, envDef);

我得到的错误

“错误代码”:“TAB_OUT_OF_BOUNDS”, "message": "选项卡位于页面之外。选项卡\"SignHere\"位于第 1 页之外。"

我的html

 <!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>

<head>
    <title>Html For pdf</title>
    <link rel='stylesheet' href='test.css'> </head>

<body>
    <div class='logo'><img src='https://testservices.colmexpro.com/registration/Styles/Images/layout/LogoForPdf.png' alt='logo'>
    </div>
    <div class='Main'>
        <div class='Bold Center'> ????? ???? ????? ???? ????? </div>
        <br/>
        <div style='direction: rtl'> ????? ??????? ????? ?????? ??? (???? ???? ??????? ?????), ????'? - 2014, ???? ??? ??????, ?? ??.?'.?? ?????? ???? ??? ??'? (????: '<span class='Bold'>?????</span>') ???? ?? ????? ?????? ????? ??????? ????? ?????. ?? ???? ?????? ????? ???? ?? ???? ????? ?? ???????? ??????? ??????? ???????? ???????? ??????? ????? ?????? ??????? ??????? ?? ???? ????? ??????, ?? ????, ??????, ????? ?? ????? ??????? ?????. </div>
        <br/>
        <div> ????? ??? ?? ?????? ??????? ?????? ?? ?????? ????? ??????? ?? ????? ????? ??? ?? ?????? ?????? ??????? ????? ??? ??? ?????? ???? ?? ????. ?????? ????? ??????/????/????/???? ???? ????? ????? ??? ????? ?????? ????. </div>
        <br/>
        <div> ????????, ??????? ???????? ????, ??? ??? ?????. </div>
        <div class='Bold HeadlineSecondary'> ?. ????? ?????? </div>
        <div class='divTable FirstTable' style='border: 1px solid #000;'>
            <div class='MainTable divTableBody'>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ??? ??????? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ??? :</span><span class='other'>  </span><span class='personal'>  Some Other Status</span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ????? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'> </span><span class='other'>  </span><span class='personal'>  aaa</span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ????? ????? (??????) </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ??? 1,000,000</span><span class='other'>  </span><span class='personal'> </span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ?????? ????? ?????? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ??? ?? ?????? ????? ??????</span><span class='other'>  </span><span class='personal'>  </span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ???? ????? ???? (??????) </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ???? ? 1,000,000</span><span class='other'>  </span><span class='personal'> </span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ???? ????? ???? (??????) </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ???? ? 100,000</span><span class='other'>  </span><span class='personal'> </span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ???? ???? ?????? ?????? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ????? ??????</span><span class='other'>  </span><span class='personal'> </span>
                    </div>
                </div>
            </div>
        </div>
        <div class='Bold HeadlineSecondary'> ?. ????? ?????? ?? ??? ???? </div>
        <div class='divTable SecondTable' style='border: 1px solid #000;'>
            <div class='MainTable divTableBody'>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ??? ???? ???? ?? ???? ???? ????? ?????? ???? ???? ???? ????? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ??</span><span class='other'>  </span><span class='personal'>  </span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ??? ????? ???? ?? ???? ???? ????? ?????? ????? ???? ????? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ?? ?????</span><span class='other'>  </span><span class='personal'>  somewhere</span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ??? ???? ?? ????? ????? ??? ?????? ?? ????? ??????? ????? ?? ????? ??????? ???????? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ??</span><span class='other'>  </span><span class='personal'> </span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ???? ???? ?????? ??????? ???????? ??????? ?????????? ????? ????? ?????. ?? ?? ???, ???? ??? ??? ????? ?????? ????? ?????? ????? ????? ?? ?????? ?????? ????? ???????, ???? ???, ?? ???? ?????? ?????? ????? ?????????? ??? ?? ????? ???? ???? ???? ???. ??? ??????? ????? ??????? ?????, ???? ???? ????? ?????? ???? ??? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ??</span><span class='other'>  </span><span class='personal'> </span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ??? ???? ?? ????? ?????? ???? ???? ??? ????? ???? ????? ????? ???? ????? ???? ?????? </span>
                    </div>
                    <div class='divTableCell'> <span class='answer'>  ??</span><span class='other'>  </span><span class='personal'> </span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'> ??? ????? ????????? ????????? ????? ???? ????? ????? ???? ???? ??? ??? ?? ???? ??????? ?????? ????? 12 ?????? ???????? </span>
                    </div>
                    <div class='divTableCell InnerTable'> <span class='answer'> <div class='ForPdf divTableRow'><div class='divTableCell'><span class='label'>?????</span>
                    </div>
                    <div class='divTableCell'><span class='answer'>120+</span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'>????? ???</span>
                    </div>
                    <div class='divTableCell'><span class='answer'>120+</span>
                    </div>
                </div>
                <div class='ForPdf divTableRow'>
                    <div class='divTableCell'><span class='label'>??? - goood</span>
                    </div>
                    <div class='divTableCell'><span class='answer'>120+</span>
                    </div>
                </div>
                </span>
            </div>
        </div>
    </div>
    </div>
    <div class='Bold HeadlineSecondary'> ?. ????? ???? ?????? ????? ????? </div>
    <div class='divTable ThirdTable' style='border: 1px solid #000;'>
        <div class='MainTable divTableBody'>
            <div class='ForPdf divTableRow'>
                <div class='divTableCell'><span class='label'> ??? ????? ??????? ?????? ????? ???? ??????? ????? (????? ???"?) </span>
                </div>
                <div class='divTableCell'> <span class='answer'>  ??? ? 1,000,000</span><span class='other'>  </span><span class='personal'> </span>
                </div>
            </div>
            <div class='ForPdf divTableRow'>
                <div class='divTableCell'><span class='label'> ?? ??? ????? ????? ?? ????? ???????? ??????? ????? ??????? ????? ???? ??? ??? ?? ???? ??????? ????? ?????  </span>
                </div>
                <div class='divTableCell InnerTable'> <span class='answer'> <div class='ForPdf divTableRow'><div class='divTableCell'><span class='label'>?? ???? ?????? ??????? ?????</span>
                </div>
                <div class='divTableCell'><span class='answer'>100+</span>
                </div>
            </div>
            <div class='ForPdf divTableRow'>
                <div class='divTableCell'><span class='label'>???? ?????? ?? ?????</span>
                </div>
                <div class='divTableCell'><span class='answer'>100+</span>
                </div>
            </div>
            </span>
        </div>
    </div>
    </div>
    </div>
    </br>
    </br>
    <div class='RightToLeft Signature Bold'> SignHereLastPage ????? __________________ </div>
    </div>
</body>

</html>

最佳答案

当您设置的 AnchorXOffset/AnchorYOffset 值导致“签名”选项卡放置在文档页面之外时,会引发 TAB_OUT_OF_BOUNDS 错误。

尝试将它们都设置为零,看看是否有效。

signHere.AnchorXOffset = "0";
signHere.AnchorYOffset = "0";

偏移值也接受负值。我建议尝试使用这些值,直到将选项卡放置在页面上的正确位置。

您还可以尝试删除以下行。

signHere.AnchorUnits = "inches";

当您的请求中未指定 AnchorUnits 属性时,AnchorXOffset/AnchorXOffset 将默认为像素。

锚定单位可以是像素、毫米、厘米或英寸。

文档 Here (展开标志这里 Accordion )

关于c# - DocuSign 自动放置( anchor 标记)返回选项卡放置在页面之外 c#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42342541/

相关文章:

java - 如何使用 Java 中的 REST API 为 DocuSign 中的复选框定义条件字段?

javascript - DocuSign for Salesforce 合作伙伴社区自定义按钮

c# - 如何在 LineSeries 图上显示文本?

c# - 如何最好地使用 VSTO 从 excel 中获取单元格值?

c# - 新手玩最好避免的事情;将连接实例添加到单例模式中

c# - 我只有 Tibco.EMS.dll,我还需要什么?

php - 如何从 docusign 下载多个信封

c# - 强制执行通用接口(interface)子类型

java - 无法实现Docusign SDK

java - DocuSign Java JWT 身份验证失败,400 错误请求,consent_required