I am a beginner in DocuSign API programming. I have a .cshtml
page for create envelope for sending to customer. When I try to create envelop from DocuSign API it shows error message like:
Page number not specified in tab element. Page Number or AnchorTabItem missing for tab \"SignHere\"."
Please see my HTML and code below.
Html
<span>
<br />
<br />
<span><b>SIGNATURE:</b></span> <span style="color:white;">pleasesignhereBP</span>
<br />
<br />
<span><b>DATE:</b></span><span style="color:white;">pleasedatehereBP</span>
<br />
<br />
</span>
Code
SignerModel objPerson = new SignerModel();
TabsModel objPersonTab = new TabsModel();
List<SignHereModel> lstPersonSignHere = new List<SignHereModel>();
SignHereModel objPersonSignHere = new SignHereModel();
objPersonSignHere.DocumentId = "1";
objPersonSignHere.PageNumber = "1";
objPersonSignHere.RecipientId = "2";
objPersonSignHere.AnchorString = "pleasesignhereBP";
objPersonSignHere.AnchorXOffset = ".2";
objPersonSignHere.AnchorYOffset = ".01";
objPersonSignHere.AnchorIgnoreIfNotPresent = "true";
objPersonSignHere.AnchorUnits = "cms";
lstPersonSignHere.Add(objPersonSignHere);
objPersonTab.SignHereTabs = lstPersonSignHere;
List<DateModel> lstPersonDateHere = new List<DateModel>();
DateModel objPersonDate = new DateModel();
objPersonDate.DocumentId = "1";
objPersonDate.PageNumber = "1";
objPersonDate.RecipientId = "1";
objPersonDate.AnchorString = "pleasedatehereBP";
objPersonDate.AnchorXOffset = ".2";
objPersonDate.AnchorYOffset = ".01";
objPersonDate.AnchorIgnoreIfNotPresent = "true";
objPersonDate.AnchorUnits = "cms";
objPersonDate.Value = DateTime.Now.ToShortDateString();
lstPersonDateHere.Add(objPersonDate);
objPersonTab.DateTabs = lstPersonDateHere;
objPerson.Tabs = objPersonTab;
I already added the objPersonDate.PageNumber = "1" but it's not working.
Updates
I have DocuSign.eSign library in my project solution. I refer this project my webapplication. Then i do some changes in the SetDocuSignSigners
function of DocuSignCommunicator
class.
objSHere.PageNumber = (!string.IsNullOrEmpty(objSHere.PageNumber)) ? objSHere.PageNumber : "1";
Please see my detailed code below.
private List<Signer> SetDocuSignSigners(List<SignerModel> lstSignerModel)
{
List<Signer> lstSigner = new List<Signer>();
if (lstSignerModel != null && lstSignerModel.Count > 0)
{
foreach (SignerModel objModel in lstSignerModel)
{
Signer objSigner = new Signer();
objSigner.Name = objModel.Name;
objSigner.Email = objModel.Email;
objSigner.RecipientId = objModel.RecipientId;
objSigner.RoutingOrder = objModel.RoutingOrder;
Tabs objTab = new Tabs();
List<SignHere> lstSalesSignHere = new List<SignHere>();
List<DateSigned> lstSalesDateHere = new List<DateSigned>();
List<FullName> lstSalesNameHere = new List<FullName>();
if (objModel.Tabs != null)
{
if (objModel.Tabs.SignHereTabs != null && objModel.Tabs.SignHereTabs.Count > 0)
{
foreach (SignHereModel objSignHere in objModel.Tabs.SignHereTabs)
{
SignHere objSHere = new Model.SignHere();
objSHere.PageNumber = (!string.IsNullOrEmpty(objSHere.PageNumber)) ? objSHere.PageNumber : "1";
objSHere.AnchorString = objSignHere.AnchorString;
objSHere.DocumentId = objSignHere.DocumentId;
objSHere.RecipientId = objSignHere.RecipientId;
objSHere.AnchorXOffset = objSignHere.AnchorXOffset;
objSHere.AnchorYOffset = objSignHere.AnchorYOffset;
objSHere.AnchorUnits = objSignHere.AnchorUnits;
objSHere.AnchorIgnoreIfNotPresent = objSignHere.AnchorIgnoreIfNotPresent;
objSHere.AnchorMatchWholeWord = "true";
lstSalesSignHere.Add(objSHere);
}
}
if (objModel.Tabs.DateTabs != null && objModel.Tabs.DateTabs.Count > 0)
{
foreach (DateModel objDateHere in objModel.Tabs.DateTabs)
{
DateSigned objDSHere = new DateSigned();
objDSHere.PageNumber = (!string.IsNullOrEmpty(objDSHere.PageNumber)) ? objDSHere.PageNumber : "1";
objDSHere.AnchorString = objDateHere.AnchorString;
objDSHere.DocumentId = objDateHere.DocumentId;
objDSHere.RecipientId = objDateHere.RecipientId;
objDSHere.AnchorXOffset = objDateHere.AnchorXOffset;
objDSHere.AnchorYOffset = objDateHere.AnchorYOffset;
objDSHere.AnchorUnits = objDateHere.AnchorUnits;
objDSHere.AnchorIgnoreIfNotPresent = objDateHere.AnchorIgnoreIfNotPresent;
objDSHere.AnchorMatchWholeWord = "true";
////objDSHere.Value = objDateHere.Value;
lstSalesDateHere.Add(objDSHere);
}
}
if (objModel.Tabs.FullNameTabs != null && objModel.Tabs.FullNameTabs.Count > 0)
{
foreach (FullNameModel objDateHere in objModel.Tabs.FullNameTabs)
{
FullName objNameHere = new FullName();
objNameHere.PageNumber = (!string.IsNullOrEmpty(objNameHere.PageNumber)) ? objNameHere.PageNumber : "1";
objNameHere.AnchorString = objDateHere.AnchorString;
objNameHere.DocumentId = objDateHere.DocumentId;
objNameHere.RecipientId = objDateHere.RecipientId;
objNameHere.AnchorXOffset = objDateHere.AnchorXOffset;
objNameHere.AnchorYOffset = objDateHere.AnchorYOffset;
objNameHere.AnchorUnits = objDateHere.AnchorUnits;
objNameHere.AnchorIgnoreIfNotPresent = objDateHere.AnchorIgnoreIfNotPresent;
objNameHere.Value = objDateHere.Value;
objNameHere.AnchorMatchWholeWord = "true";
lstSalesNameHere.Add(objNameHere);
}
}
}
objTab.SignHereTabs = lstSalesSignHere;
objTab.DateSignedTabs = lstSalesDateHere;
objTab.FullNameTabs = lstSalesNameHere;
objSigner.Tabs = objTab;
lstSigner.Add(objSigner);
}
}
return lstSigner;
}
I don't know this is a best practice but my issue is solved. Please advice if this is not a good practice.
After the library change
Sadly it's not working in the signature placement in documents. I have two fields in my document Signature and Signaturedate but these fields are placed in wrong placement when I signed the document via DocuSign website. Please see the document below.
So assign page number is not a solution for my issue.