Issue with Signature Validation After Upgrade to WebViewer 11.6.0

We are currently using the WebViewer SDK to apply multiple signatures to PDF files. Everything was working fine with version 11.5.0, but after upgrading to version 11.6.0, we noticed an issue. When applying a new signature, the older signatures become invalid in Adobe Acrobat, even though they still appear valid within WebViewer.

Details:

  • Product: WebViewer
  • Version: 11.6.0
  • Previous Working Version: 11.5.0
  • Issue:
    • After upgrading to WebViewer 11.6.0, PDFs with signatures applied in WebViewer 11.6.0 show invalid signatures in Adobe Acrobat, while they still show as valid in WebViewer.
    • PDFs with signatures applied using WebViewer 11.5.0 show valid signatures in Adobe Acrobat as expected.

Steps to Reproduce:

  1. Apply multiple digital signatures to a PDF using WebViewer SDK 11.6.0.
  2. Open the signed PDF in Adobe Acrobat — the older signatures show as invalid.
  3. Apply the same signatures using WebViewer SDK 11.5.0.
  4. Open the signed PDF in Adobe Acrobat — all signatures are valid.

Observations:

  • The issue only occurs after upgrading to version 11.6.0.
  • The same codebase is used for both versions — no code changes were made between upgrades.
  • The issue only affects Adobe Acrobat; WebViewer shows the signatures as valid.
  • There appear to be no differences in the signature metadata between the two versions when inspected within WebViewer.

In the first file, I applied a signature using WebViewer 11.6.0. When opened in Adobe Acrobat, the previous signatures appear as invalid.

Version-11.6.0 (Not Working in Adobe).pdf (54.2 KB)

In the second file, I applied the signature using WebViewer 11.5.0, and when opened in Adobe Acrobat, all signatures are shown as valid.

Version-11.5.0 (Working).pdf (53.8 KB)

Please investigate if there have been any changes in the handling of digital signatures in WebViewer 11.6.0 that could cause this issue. Specifically, I would like to understand why Adobe Acrobat marks older signatures as invalid after the upgrade, despite no changes in the code or certificate.

Please let me know If you need anything else.

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


It appears that after upgrading to WebViewer 11.6.0, you are experiencing an issue where older signatures become invalid in Adobe Acrobat, even though they appear valid in WebViewer. This type of issue can arise due to changes in how the signature information or metadata is handled between versions, even if no code changes were made on your end.

Some things you can try:

  • Check if there are any changes in the signature handling or validation process in the WebViewer 11.6.0 documentation.

  • Review the signature properties and metadata in both WebViewer and Adobe Acrobat to identify any discrepancies.

  • Ensure that the certificate chain used for signing is complete and available to Adobe Acrobat.

  • Consider testing with a simple PDF to isolate whether the issue is with specific document properties or signatures.

  • Look into any updates or patches for WebViewer 11.6.0 that might address signature validation issues.




Here are some resources that might help you:



Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hi Rahul,

Thank you for reaching out.

Have you tried to upgrade to the latest version 11.8.0 to see if that resolves the issue?

Can you show how you are adding the signature to the PDF? After adding it using Webviewer signatureCreateTool on version 11.5.0 all signatures got invalid as well on my side.

Best Regards,
Mickaël.

1 Like

Yes . Same issue exist in the 11.8.0.

I am using above code to apply digital signatures in the PDF.

await PDFNet.runWithCleanup(async () => {
    const signFieldName = [];
    doc.initSecurityHandler();
    doc.lock();
    digitalSignatureFieldArray = '';
    var counter = 0;
    for (const fitr = await doc.getDigitalSignatureFieldIteratorBegin(); await fitr.hasNext(); await fitr.next()) {
        const approvalSigField = await fitr.current();
        if (!await approvalSigField.hasCryptographicSignature()) {

        await approvalSigField.setDocumentPermissions(PDFNet.DigitalSignatureField.DocumentPermissions.e_annotating_formfilling_signing_allowed);

        await approvalSigField.signOnNextSaveFromURL(filePath[0], password);          
       
        updatedBytesArray = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_incremental);
        

        counter++;
    }
}

In version 11.5.0, it is working fine. I have also attached files of two different versions: one is 11.5.0 (working fine) and the other is 11.6.0 (not working in Adobe Acrobat but working in the web viewer). Both files use the same code, so there seems to be an issue in version 11.6.0.

1 Like

Hi Rahul,

Thank you for your reply.

To investigate further, I invite you to take one of our samples, reproduce the issue, and provide us with the sample project so we can reproduce it on our side as well.

You can find base samples here: Free Trial: JavaScript PDF Viewer | Apryse documentation

Best Regards,
Mickaël.

1 Like

Hi,

Please find my code below. You need to call the ApplyDigitalSignatureOnFile function on 'the button click event. We apply the digital signature when the user clicks the Signature button, which is an external button. In this sample, when the user performs an e-signature using the signature panel from web viewer UI, we create a corresponding digital signature field for each e-sign. The certificate is then applied when the user clicks the Digital Signature button , and user can add others annotation like shapes, stamp , measurement …etc as well from UI. After applied digital signature we save the updated file in the database. It is working fine in 11.5.0 but not working in 11.6.0 and all latest version

$(document).ready(function () {   
      
    WebImageViewer();
});

var globalDocumentViewer = '', globalAnnotationManager = '';
var globalinstance = '';
var signatureCounter = 1;

var newlyAnnotationArray = [];

function WebImageViewer() {
    //Initiate the webviewer.	
    WebViewer(
        {
            path: "../../../js/lib/PdfTronWebViewer11.8.0/",
            preloadWorker: 'pdf',
            initialDoc: 'https://example.com/file.pdf',
            licenseKey: 'licenseKey',
            fullAPI: true,
            enableMeasurement: true,
            isAdminUser: true,
            signature: {
                revocationTimeout: 2000,
            }
        }, viewer
    ).then(instance => {
        globalinstance = instance;
        instance.UI.enableFeatures([instance.UI.Feature.Initials]);
        const { VerificationOptions, openElements, loadDocument } = instance.UI;
        const { PDFNet, documentViewer } = instance.Core;
        const { annotationManager, Annotations } = instance.Core;
        const { WidgetFlags } = Annotations;
        globalDocumentViewer = documentViewer;     
      

        annotationManager.addEventListener('annotationChanged', (annotations, action) => {
            if (action === 'add') {
                if (annotations !== null && annotations.length == 1 && annotations[0].Subject == "Signature") {
                    addSignatureToWidget(annotations[0]);
                }
            }
        });      
        // Function to add signature image to the widget
        const addSignatureToWidget = async (widgetAnnotation) => {
            signatureCounter++;
            widgetAnnotation.SignFieldName = "_digitalsign_" + signatureCounter;
            widgetAnnotation.Id = "_esign_" + signatureCounter;
            newlyAnnotationArray.push(widgetAnnotation);
        };
 
    });
}


var digitalSignatureFieldArray = '';
const ApplyDigitalSignatureOnFile = async () => {
    const { VerificationOptions, openElements, loadDocument } = globalinstance.UI;
    const { PDFNet, documentViewer } = globalinstance.Core;
    const { annotationManager, Annotations } = globalinstance.Core;
    const { WidgetFlags } = Annotations;
    // Sets the entire document to be read-only
    const doc = await documentViewer.getDocument().getPDFDoc();

    var idCounter = 0;
    for (var i = 0; i < newlyAnnotationArray.length; i++) {
        idCounter = newlyAnnotationArray[i].Id.split('_')[2];
      
        // set flags for required
        const flags = new WidgetFlags();
        flags.set('Required', false);
        // create a form field
        const field = new Annotations.Forms.Field( "_digitalsignField_" + idCounter, {
            type: 'Sig',
            flags,
        });
        // create a widget annotation
        const widgetAnnot = new Annotations.SignatureWidgetAnnotation(field, {
            appearance: '_DEFAULT',
            appearances: {
                _DEFAULT: {
                    Normal: {
                        offset: {
                            x: 100,
                            y: 100,
                        },
                    },
                },
            },
        });

        // set position and size
        widgetAnnot.PageNumber = newlyAnnotationArray[i].PageNumber;
        widgetAnnot.X = newlyAnnotationArray[i].X;
        widgetAnnot.Y = newlyAnnotationArray[i].Y;
        widgetAnnot.Width = newlyAnnotationArray[i].Width;
        widgetAnnot.Height = newlyAnnotationArray[i].Height;      
        widgetAnnot.Id = "_digitalsign_" + idCounter;
          //add the form field and widget annotation
        annotationManager.getFieldManager().addField(field);
        annotationManager.addAnnotation(widgetAnnot, { autofocus: true });
        annotationManager.drawAnnotationsFromList([widgetAnnot]);
    }
    
    newlyAnnotationArray = [];
    const xfdfString = await annotationManager.exportAnnotations({
        useDisplayAuthor: true,
    });
    const mergeOptions = new PDFNet.PDFDoc.MergeXFDFOptions();
    mergeOptions.setForce(true);
    await doc.mergeXFDFString(xfdfString, mergeOptions);

    var updatedBytesArray = '';
    var password = 'certificatePassword';
  
    try {
            // Run PDFNet methods with memory management
            await PDFNet.runWithCleanup(async () => {
                doc.initSecurityHandler();
                doc.lock();
                digitalSignatureFieldArray = '';
                for (const fitr = await doc.getDigitalSignatureFieldIteratorBegin(); await fitr.hasNext(); await fitr.next()) {
                    const approvalSigField = await fitr.current();
                    if (!await approvalSigField.hasCryptographicSignature()) {
                        await approvalSigField.setDocumentPermissions(PDFNet.DigitalSignatureField.DocumentPermissions.e_annotating_formfilling_signing_allowed);
                        await approvalSigField.signOnNextSaveFromURL(certificatePath, password);                     
                        updatedBytesArray = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_incremental);                       
                    }
                }
                const blob = new Blob([updatedBytesArray], { type: 'application/pdf' });               
                newlyAnnotationArray = [];
                globalinstance.UI.loadDocument(blob, { filename: 'myfile.pdf', extension: "pdf" });

            });
        
    }
    catch (err) {
        
    }
 }

Please let me know If you need anything else.?

1 Like

Hi Rahul,

I’ve tried implementing this sample, but the code is not self-sufficient to be runnable.

Ideally, I would need a runnable sample project (zip folder) that runs by itself when starting it with npm i && npm run start

So far, I’m missing:

  • certificatePath (And the certificate, I’m guessing)
  • isDigitalSignatureAdded

Best Regards,
Mickaël.

1 Like

This is the certificate Path. You can use your own certificate and password.

For this just remove it. I am removing it from above code.

1 Like