Vladimir Potapov
Vladimir Potapov

Reputation: 2437

DocuSign Auto-Place (Anchor Tagging) return Tab is placed off of the page c#

I am using Docusign to add a signature to my PDF documents in c#.

I am adding this label with Id,class and text "SignHereLastPage" to end of my html page. I then convert it to a 2 page PDF file.

 <!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>

If i will set signHere.PageNumber to 2,and add x/y Position all working fine,but i want to add this sign zone automatically with my textValue.

My code:

   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);

The error that i get

"errorCode": "TAB_OUT_OF_BOUNDS", "message": "Tab is placed off of the page. Tab \"SignHere\" is located off of page 1."

My 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>

Upvotes: 2

Views: 2741

Answers (1)

Praveen Reddy
Praveen Reddy

Reputation: 7383

The TAB_OUT_OF_BOUNDS error is thrown when AnchorXOffset/AnchorYOffset values you have set is causing the Signature tab to be placed outside the document page.

Try setting both of them to Zero and see if it works.

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

The Offset values also accepts negative values. I suggest playing around these values until you get the tab placed at the right location on the page.

You can also try removing the following line.

signHere.AnchorUnits = "inches";

The AnchorXOffset/AnchorXOffset will default to pixels when the AnchorUnits property is not specified in your request.

AnchorUnits could be pixels, mms, cms or inches.

Documentation Here (Expand the signHere accordian)

Upvotes: 3

Related Questions