DocuSign自动放置(锚点标记)返回标签位于页面c#之外

时间:2017-02-20 10:49:11

标签: c# docusignapi

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

我将这个标签添加到Id,类和文本" 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);

我得到的错误

&#34; errorCode&#34;:&#34; TAB_OUT_OF_BOUNDS&#34;,   &#34; message&#34;:&#34;标签位于页面之外。 Tab \&#34; SignHere \&#34;位于第1页之外。&#34;

我的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>

1 个答案:

答案 0 :(得分:2)

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

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

__STDC_LIB_EXT1__

偏移值也接受负值。我建议玩这些值,直到你将标签放在页面的正确位置。

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

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

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

AnchorUnits可以是像素,毫米,厘米或英寸。

文档Here(展开signHere accordian)