darrunategui | Posts: 12

Text Anchors don't work after a document has been added to a package

0 votes
I am seeing a bug where the following occurs: 1. I create a package with 1 document and 1 signature placed using text anchors. 2. At a later time, I programmatically add another signature to that same package/document using text anchors. Expected Result: The signature I want to add is placed according to the text anchor. Actual Result: The signature is placed at position (0, 0) and the text anchor is completely ignored. The code below demonstrates my approach and bug. I've also attached the pdf I was using to test this.
var signer1 = (Email: "[email protected]",
                           Id: "signer-1",
                           FirstName: "David",
                           LastName: "NormalGmail",
                           Company: "ABC Company",
                           Title: "Software Developer");

            var doc = (Name: "Testing Doc",
                       Id: "DocId1");

            var anchor = (Text: "Please Sign",
                          Occurrence: 0,
                          Character: 0,
                          Width: 200,
                          Height: 50);

            PackageId packageId = null;
            using (var fs = File.OpenRead(@"test.pdf"))
            {
                var package = PackageBuilder.NewPackageNamed(doc.Name + " Package")
                              .WithSettings(DocumentPackageSettingsBuilder.NewDocumentPackageSettings())
                              .WithSigner(SignerBuilder
                                          .NewSignerWithEmail(signer1.Email)
                                          .WithCustomId(signer1.Id)
                                          .WithFirstName(signer1.FirstName)
                                          .WithLastName(signer1.LastName)
                                          .WithCompany(signer1.Company)
                                          .WithTitle(signer1.Title))
                              .WithDocument(DocumentBuilder
                                            .NewDocumentNamed(doc.Name)
                                            .FromStream(fs, DocumentType.PDF)
                                            .WithId(doc.Id)
                                            // This signature is placed correctly according to the text anchor
                                            .WithSignature(SignatureBuilder.SignatureFor(signer1.Email)
                                                           .WithPositionAnchor(TextAnchorBuilder.NewTextAnchor(anchor.Text)
                                                                               .AtPosition(TextAnchorPosition.TOPLEFT)
                                                                               .WithOccurrence(anchor.Occurrence)
                                                                               .WithCharacter(anchor.Character)
                                                                               .WithOffset(0, -anchor.Height)
                                                                               .WithSize(anchor.Width, anchor.Height)))).Build();

                packageId = eslClient.CreatePackage(package);
            }

            // The text anchor here is completely ignored
            var sigBuilder = SignatureBuilder.SignatureFor(signer1.Email)
                             .WithPositionAnchor(TextAnchorBuilder.NewTextAnchor(anchor.Text)
                                                 .AtPosition(TextAnchorPosition.BOTTOMLEFT)
                                                 .WithOccurrence(anchor.Occurrence)
                                                 .WithCharacter(anchor.Character)
                                                 .WithOffset(0, 0)
                                                 .WithSize(anchor.Width, anchor.Height));

            var documentPackage = eslClient.GetPackage(packageId);
            eslClient.ApprovalService.AddApproval(documentPackage, doc.Id, sigBuilder.Build());

Attachments
test.pdf98.88 KB
Approved Answer
harishaidary | Posts: 1812

Reply to: Text Anchors don't work after a document has been added to a package

0 votes
Hi there, All extraction features in eSignLive are only available during document upload. It is as designed and not a bug. Please refer to our documentation: https://docs.esignlive.com/content/c_integrator_s_guide/sdk/c_managing_documents/extraction.htm#Text Therefore, you will have to add all your anchors during document upload or position subsequent signatures using x-y coordinates.

darrunategui | Posts: 12

Reply to: Text Anchors don't work after a document has been added to a package

0 votes
Thanks for the clarification. I did not notice this when I was reading through the documentation. Is there a reason why this was chosen as a design decision? My end goal was to provide a feature to change a signer grammatically. This would include 1. Removing the original signer 2. Adding a new signer 3. Adding all new signatures and fields to replace the original signer. 4. Give the new signer fields default values based in dynamic data hosted in our back end database I suppose I can look at the absolute positioning of the original signature block and fields and then just duplicate those settings to create the new signature block and fields.... but that solution isn't as clean as using text anchors after document upload. Is this a feature that is planned for the future?

harishaidary | Posts: 1812

Reply to: Text Anchors don't work after a document has been added to a package

0 votes
Are the signatures of the new signer going to be in the same place as the original one? If so, you could simply do an update on the signer information (i.e. update first name, last name, and email address) and the positioning of the signatures will still be kept. As to why extraction only works during document upload, it is only during document upload that we process the document (e.g. search for texts, form fields, etc). Then, the pdf is simply rendered into images. And I don't believe this feature will be changed any time soon.

harishaidary | Posts: 1812

Reply to: Text Anchors don't work after a document has been added to a package

0 votes
Hi there, There is actually a plan to change the extraction feature to be able to reprocess documents upon adding signers. Hence, you'll be able to add text anchors after the document has been added. However, there is no timetable for this. I'll post back here for any updates on this.

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off