Issue with PreSigned PDF in WebViewer

WebViewer Version: 10.10.1

Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? Yes
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
Is your issue related to annotations? Yes

Please give a brief summary of your issue:

Load a PDF inside the webviewer, without breaking pre-existing signatures

Please describe your issue and provide steps to reprodu
testTUTTI CAMPI firmati non loccato.pdf (107.7 KB)
ce it:

I have a pdf containing a valid signature (signed on the backend side via the “PDFTron.NET.x64” Version=“11.1.0” library in the demo environment)

Loading that pdf into the webviewer and downloading it immediately, the pre-existing signature is invalid.

Using PDFTron.NET.x64 without WebViewer we can, given a pdf with a valid signature, add a signature type acrofield and sign it without breaking the pre-existing signature.

Is it possible from the webviewer to add an acrofield without breaking a pre-existing signature?

Please provide a link to a minimal sample where the issue is reproducible:

I attach a sample pdf with which I did the tests

The issue can be replicated using your demo
https://sdk.apryse.com/samples/web/samples/full-apis/ViewerDigitalSignatureValidationTest/

1 Like

Hi there,

Is it possible from the webviewer to add an acrofield without breaking a pre-existing signature?

This will depend on the permission settings by the signature field. You can see the list of permissions that you can set on the digital signatures here:
https://sdk.apryse.com/api/web/Core.PDFNet.DigitalSignatureField.html#.DocumentPermissions__anchor

Best regards,
Kevin Kim

1 Like

From your answer I don’t understand how to download, from the webviewer, a previously signed document correctly without breaking the signature.

I add that even in your demo page linked above, if I download a document with a valid signature, then immediately reload the document in the webviewer, the signature is corrupted.


Thankyou for your support,
William

1 Like

Hi there,

This actually fails on the sample demo for 2 reasons:

  1. The file is not incrementally saved, i.e.
    instance.UI.downloadPdf({ flags: instance.Core.SaveOptions.INCREMENTAL });
    Using the download button doesn’t automatically save the file as incremental, so you will need to set this explicitly.

  2. The sample page will add a watermark to the document, which is considered making a change on the document.
    If you use a registered license, the signature should remain valid.

Best regards,
Kevin Kim

1 Like

Hello,
I tried to implement your solution, on a webviewer with a valid license, but it doesn’t work

These are my tests

1) Listening to onDocumentLoad() and immediately downloading the document: the pre-existing signature works correctly
saveSettings FLAG doesn’t seems to make differences. I tested no flag, flag INCREMENTAL, or LINEARIZED and i get the same result

this.instance.Core.documentViewer.addEventListener('documentLoaded', async () => {
    this.instance?.UI.downloadPdf({ flags: this.instance?.Core.SaveOptions.INCREMENTAL 
});

2) Listening to onDocumentLoad(), change to editAnnotationView and downloading the document: the pre-existing signature breaks

My Code:

this.instance.Core.documentViewer.addEventListener('documentLoaded', async () => {
            this.switchToEditAnnotationsView();
            setTimeout(() => {

                // CHECK IMAGE - RESULT IF I DOWNLOAD IT WITH SaveOptions.INCREMENTAL
                this.instance?.UI.downloadPdf({ flags: this.instance?.Core.SaveOptions.INCREMENTAL});

                // CHECK IMAGE - RESULT IF I DOWNLOAD IT WITH SaveOptions.LINEARIZED
                // this.instance?.UI.downloadPdf({ flags: this.instance?.Core.SaveOptions.LINEARIZED});

            }, 1000);
        });

// even manually clicking on data-element="signatureFieldToolGroupButton" I get the same result
switchToEditAnnotationsView() {
        const iframeDocument = this.getIframeDocument();
        if (iframeDocument) {
            const buttonForme = iframeDocument.querySelector('.ribbon-group') as HTMLElement;
            buttonForme.click();
            const div = iframeDocument.querySelector('.tool-group-button') as HTMLElement;
            if (div?.children.length) {
                const button = div.children[0] as HTMLElement;
                if (button) {
                    button.click();
                    button.click();
                }
            }
        }
    }

// RESULT IF I DOWNLOAD IT WITH SaveOptions.INCREMENTAL

// RESULT IF I DOWNLOAD IT WITH SaveOptions.LINEARIZED

1 Like

Hi there,

2) Listening to onDocumentLoad(), change to editAnnotationView and downloading the document: the pre-existing signature breaks

When you switch to this view on WebViewer (form field creation mode), the annotations you see on the document are added as temporary annotations. This would be considered making a change to the document hence breaking the signatures.

Starting from version 11.0, there are no temporary annotations and should not be triggering the annotationChanged events:

Best regards,
Kevin Kim

1 Like

Hi, is there any way to fix this while staying on v10? I can’t update the library now

Thankyou

1 Like

Hi there,

If you change the permission settings on the DigitalSignatureField before adding the certificate, then it will stay valid even if the annotations have been added to the document:
https://sdk.apryse.com/api/web/Core.PDFNet.DigitalSignatureField.html#.DocumentPermissions__anchor

Unfortunately, this was a major change that was added to 11.0 and cannot be ported back. I recommend. you not to switch to the formfield creation mode.

best regards,
Kevin

1 Like