Some test text!

menu

Verify a signature using JavaScript

Only available with the Full API

Try our experimental web demo for digital signature verification.

EXPERIMENTAL FEATURE. Digital signature verification is undergoing active development, but currently does not support a number of features. If we are missing a feature that is important to you, or if you have files that do not act as expected, please contact us using one of the following forms: https://www.pdftron.com/form/trial-support/ or https://www.pdftron.com/form/request/

To verify all cryptographic digital signatures in a document:

// Open an existing PDF
const doc = await PDFNet.PDFDoc.createFromURL(doc_url);
doc.initSecurityHandler();

// Choose a security level to use, and change any verification options you wish to change
const opts = await PDFNet.VerificationOptions.create(PDFNet.VerificationOptions.SecurityLevel.e_compatibility_and_archiving);

// Trust a certificate
await opts.addTrustedCertificateFromURL(certificate);

// Iterate over the signatures and verify all of them.
const digsig_fitr = await doc.getDigitalSignatureFieldIteratorBegin();
for (; await digsig_fitr.hasNext(); await digsig_fitr.next()) {
    const curr = await digsig_fitr.current();
    const result = await curr.verify(opts);
    if (await result.getVerificationStatus()) {
        console.log('Signature verified');
    } else {
        console.log('Signature verification failed');
    }
}

Digital signatures
Full code sample which demonstrates using the digital signature API to digitally sign, certify, and/or verify PDF documents.

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

Join our live demo to learn about use cases & capabilities for WebViewer

Learn more
close