Verify for multiple signatures

Overview

GroupDocs.Signature supports verification of documents for different signature types. This approach requires adding all required verification options to a list.

Here are the steps to verify a document for multiple signatures with GroupDocs.Signature:

This example shows how to search for different signature types in the document.

  // The path to the documents directory.
  const filePath = Constants.SAMPLE_SIGNED_MULTI; // Assuming Constants.SAMPLE_SIGNED_MULTI is defined elsewhere

  // Initialize Signature instance
  const signature = new signatureLib.Signature(filePath);

  // Initialize TextVerifyOptions
  const textVerifyOptions = new signatureLib.TextVerifyOptions();
  textVerifyOptions.setAllPages(true); // this value is set by default
  textVerifyOptions.setText('Text signature');
  textVerifyOptions.setSignatureImplementation(signatureLib.TextSignatureImplementation.Native);
  textVerifyOptions.setMatchType(signatureLib.TextMatchType.Contains);

  // Initialize BarcodeVerifyOptions
  const barcVerifyOptions = new signatureLib.BarcodeVerifyOptions();
  barcVerifyOptions.setAllPages(true); // this value is set by default
  barcVerifyOptions.setText('12345');
  barcVerifyOptions.setMatchType(signatureLib.TextMatchType.Contains);

  // Initialize QrCodeVerifyOptions
  const qrcdVerifyOptions = new signatureLib.QrCodeVerifyOptions();
  qrcdVerifyOptions.setAllPages(true); // this value is set by default
  qrcdVerifyOptions.setText('John');
  qrcdVerifyOptions.setMatchType(signatureLib.TextMatchType.Contains);

  // Initialize DigitalVerifyOptions
  const digtVerifyOptions = new signatureLib.DigitalVerifyOptions();
  digtVerifyOptions.setPassword('1234567890');

  // Verify document signatures
  const javaArray = java.newInstanceSync("java.util.ArrayList")
  javaArray.add(textVerifyOptions);
  javaArray.add(barcVerifyOptions);
  javaArray.add(qrcdVerifyOptions);
  javaArray.add(digtVerifyOptions);
  const result = signature.verify(javaArray);

  if (result.isValid()) {
    console.log('\nDocument was verified successfully!');
  } else {
    console.log('\nDocument failed the verification process.');
  }

More resources

GitHub Examples

You may easily run the code above and see the feature in action in ourΒ GitHub examples:

Free Online Apps

Along with the full-featured .NET library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.