Filling a text field annotation on a digitally signed document

WebViewer Version: 8.9

Do you have an issue with a specific file(s)?

Annotations

Can you reproduce using one of our samples or online demos?

No

Are you using the WebViewer server?

No

Does the issue only happen on certain browsers?

No

Is your issue related to a front-end framework?

No, but I am using react-typescript

Is your issue related to annotations?

Yes

Please give a brief summary of your issue:
(Think of this as an email subject)

Filling a text field and saving it invalidates the existing digital-signature.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

We are implementing a multi client signature feature using PDFTron that has form filling (text, date, etc.) with digital-signature. Filling and signing of clients are done in order (synchronously). This means that each client (in order) will have to fill some details and digitally sign the document. Using the code snippet below we can successfully do this with the first client.

            // fill annotations in viewer, then...
            const xfdfString = await annotationManager.exportAnnotations();
            const data = await doc.getFileData({ xfdfString });
            await documentViewer.loadDocument(data);
 
            // digitally-sign
            const doc = await documentViewer.getDocument().getPDFDoc();
            const buf = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_incremental);
            // save buffer to file

However, the succeeding clients will invalidate the previous digital-signature.

In the signature property it is mentioned that “The signer has specified that Form Fill-in, Signing and Commenting are allowed for this document.”

We think that “doc.getFileData({ xfdfString })” part invalidates the digital-signature since it modifies the PDF.

So the question is, how can we update/fill annotation and be able to save a document with the existing digital-signature still valid?

Hi Adrian,

Thank you for contacting us. It would be of great help to our investigation if you could provide us the following info:

  1. In the question you mentioned that

We think that “doc.getFileData({ xfdfString })” part invalidates the digital-signature since it modifies the PDF.

And we are wondering if you could set up a local environment without this line (so no auto form fillings for 2nd+ signers), and try signing the document? This is to confirm if the issue really happens there.

  1. Could you provide us an example PDF you are using?

  2. Could you send us a more complete code snippet that can be used to reproduce the issue?

Thanks again and please let us know.

Yixiao

Hello Yixiao,

Thank you for the response.

After consultation we found out that “doc.getFileData({ xfdfString })” is not the one invalidating the digital-signature. Instead, changing the properties of the FormField does (example: setting to readonly or hidding).

Will it be possible to change FormField properties (hidden, readonly) and not invalidate existing digital signature?

Thank you again for the support.

Hi Adrian,

I’m not sure if you are aware of this API:

DigitalSignatureField.setDocumentPermissions

As you may have noticed from the API documentation, we have a limited number of permissions options there. Depending on your actual situation, you may choose to set the field’s permission to 4 which means unrestricted changes can be made after singing. This should allow you to change annotation properties, but also lowers the document integrity check’s criteria.
However, as this is for your multi-signer process, you will be able to restrict the transmission of the document to be on your server only. You can also restrict the front-end functionalities in WebViewer to prevent the document from being modified by all sorts of tools so this shouldn’t be a concern.

Yixiao