Filling fields on multiple signature form invalidates previous signature

Adobe PDF has the functionality to set up forms that have multiple signature fields, with each of those signatures being associated with a specified set of data fields. We have a form like that.



The first user fills out the first set of fields and applies his digital signature. When the first signature is applied, all the fields that go with that signature are locked (i.e. made read-only).

The form is then routed to the next user, who repeats the procedure with the next group of fields, filling them out and then applying his digital signature in their associated digital signature field, which locks that group of fields.



Each digital signature sets up another ‘revision’ (what Adobe calls it) of the document. As long as no users change any of the fields that are associated with previous digital signatures, the signatures all remain valid.



We are trying to automate part of this process by having Aspose PDF fill out the each group of data fields (the digital signature is applied manually by the signee) before the form is routed to the next signee. It fills out the first group and the first person signs, which locks the first group. Then Aspose PDF fills out the second group, but when it does it invalidates the first signature.



I am attaching a simple demo app. Run fill1.bat to populate Field 1. It will output demoOut1.pdf. Then sign Signature 1. Notice that it locks Field 1. Then run fill2.bat. It will populate Field 2 and output demoOut2.pdf. You will see that now the first signature is invalid. However, you can manually open demoOut1.pdf and populate Field 2 and it does not invalidate the first signature.



I’ve also noticed that I don’t even have to change the PDF. All I have to do is to open it and save it with Aspose and it will invalidate the signature.



All of this with Aspose PDF 9.8



How can I use Aspose PDF to populate fields in the form without invalidating previous signatures?



Thanks



Steve

Hi Steve,

Thanks for your inquiry. I have tested your scenario with shared document using Aspose.Pdf for .NET 10.3.0 and managed to observe the reported issue. For further investigation, I have logged an issue in our issue tracking system as PDFNEWNET-38630 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

Please feel free to contact us for any further assistance.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:
Calibri;color:#333333;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA”>Best Regards

Hi Tilal,
Is there anything I might try for a workaround? We are well into an important project that depends on this working, and I assumed that it would. To find out now that it doesn’t really throws a wrench into things.
Any possibility this bug might be addressed in the next release? If there is anything I can do to help speed up the resolution, I will be happy to.
Thanks,
Steve

Hi Steve,


Thanks for your feedback. I am afraid currently we can not share any workaround. We have shared your concern and requested our development team to complete investigation at their earliest. As soon as investigation is completed then we would be in good position to share an ETA or any possible workaround. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,

Please do keep me updated.

As always, thanks for your prompt attention to this problem.

Steve

Hello,

Can I get an update on the status of this issue? Can I get an approximate date that the issue will be investigated or resolved?

Thanks,
Steve

Hi Steve,


Thanks for your inquiry. I am afraid we can not share any ETA at the moment, as the investigation of the issue is still not completed. It is more complex issue than we expected.

Meanwhile, we will appreciate it if you please share your sample document and code. So we would ensue that we have addressed your issue exactly.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,

I included a sample app and pdf in the post of my original incident. What do you need that my sample app does not address?

Steve

Hi Steve,


Please ignore previous message from Tilal as we already have the required artifacts. The development team will further look into the details of this problem and will keep you posted on the status of correction. We are sorry for this inconvenience.

Anything new on this? We cannot proceed with our project until this is working.

Thanks

Steve

Hi Steve,


Thanks for your inquiry. I am afraid our product team has not completed the investigation yet. We have requested our team to complete it and share an ETA or findings as soon as possible. We will notify you as soon as we made some significant progress towards issue resolution.

Thanks for your patience and cooperation.

Best Regards,

Hi Gil,


Thanks for contacting support.

The feature requested earlier is still not implemented and the product team is working on its implementation. However I have intimated them to share the latest status and any possible ETA regarding its implementation. We are sorry for this delay and inconvenience.

The issues you have found earlier (filed as PDFNET-38630) have been fixed in Aspose.PDF for .NET 21.11.

Haha. I notice the time comment before the notification is “6 YEARS LATER”. I guess better late than never in some cases but in this case too late to help with our problem.

Steve

@swl

We apologize for the delay and inconvenience you have been facing. Please note that the resolution time of the issues depends upon many factors to be noticed e.g. number of issues logged prior to it, nature and complexity of the issue, a number of API components that need to change/update/revamp in order to fix the issue.

In the case of your issue, it required deeper investigation, and new methods were introduced in the API in order to fix it. After signing, you can use Method FillFieldInSignedDocument (in Aspose.Pdf.Facades.Form):

Example for use:

Stream stream;
var form = new Form(dataDir + "SignedPdfForm.pdf");
form.FillFields(new string[] {"Field1"}, new string[] { "+"}, out stream));

Full Code with fixes:

public void PDFNET_38630()
{
    FillForm("demoFormMaster.pdf", "Fillform.Pdf", "Field 1");
    DigitalSign("Signature 1", "Fillform.pdf", "Signature1.pdf");
    var form = new Pdf.Facades.Form(dataDir + "Signature1.pdf");
    form.FillFieldInSignedDocument("Field 2", "+", dataDir + "Fillform1.pdf");
}
public static void FillForm(String inputPdf, String outpuPdf, String field)
{
    //Open pdf file
    using (var pdfDoc = new Aspose.Pdf.Document(dataDir + inputPdf))
    {
        TextBoxField textBoxField = pdfDoc.Form[field] as TextBoxField;
        textBoxField.Value = field + " +++";
        pdfDoc.Save(dataDir + outpuPdf);
    }
}
public static void DigitalSign(string signFieldName, string inputdocument, string outputdocument)
{
    using (Document pdfDocument = new Document(dataDir + inputdocument))
    {
        using (PdfFileSignature pdfSign = new PdfFileSignature(pdfDocument))
        {
            pdfSign.SignatureAppearance = dataDir + "Aspose.jpg";
            var signature = new PKCS7(dataDir + "R_password_111111.pfx", "111111");
            signature.ShowProperties = true;
            Rectangle rect1 = pdfDocument.Form[signFieldName].Rect;
            var rect = new System.Drawing.Rectangle((int)rect1.LLX, (int)rect1.LLY, (int)rect1.URX, (int)rect1.URY);
            pdfSign.Sign(1, "Signature Reason", "Contact", "Location", true, new System.Drawing.Rectangle(), signature);
            pdfSign.Save(dataDir + outputdocument);
        }
    }
}