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:
Create a new instance of the Signature class and pass the source document path or stream as a constructor parameter.
Call the Verify method of the Signature class instance and pass the filled list of List<VerifyOptions> to it.
This example shows how to search for different signature types in the document.
// The path to the documents directory.constfilePath=Constants.SAMPLE_SIGNED_MULTI;// Assuming Constants.SAMPLE_SIGNED_MULTI is defined elsewhere// Initialize Signature instanceconstsignature=newsignatureLib.Signature(filePath);// Initialize TextVerifyOptionsconsttextVerifyOptions=newsignatureLib.TextVerifyOptions();textVerifyOptions.setAllPages(true);// this value is set by defaulttextVerifyOptions.setText('Textsignature');textVerifyOptions.setSignatureImplementation(signatureLib.TextSignatureImplementation.Native);textVerifyOptions.setMatchType(signatureLib.TextMatchType.Contains);// Initialize BarcodeVerifyOptionsconstbarcVerifyOptions=newsignatureLib.BarcodeVerifyOptions();barcVerifyOptions.setAllPages(true);// this value is set by defaultbarcVerifyOptions.setText('12345');barcVerifyOptions.setMatchType(signatureLib.TextMatchType.Contains);// Initialize QrCodeVerifyOptionsconstqrcdVerifyOptions=newsignatureLib.QrCodeVerifyOptions();qrcdVerifyOptions.setAllPages(true);// this value is set by defaultqrcdVerifyOptions.setText('John');qrcdVerifyOptions.setMatchType(signatureLib.TextMatchType.Contains);// Initialize DigitalVerifyOptionsconstdigtVerifyOptions=newsignatureLib.DigitalVerifyOptions();digtVerifyOptions.setPassword('1234567890');// Verify document signaturesconstjavaArray=java.newInstanceSync("java.util.ArrayList")javaArray.add(textVerifyOptions);javaArray.add(barcVerifyOptions);javaArray.add(qrcdVerifyOptions);javaArray.add(digtVerifyOptions);constresult=signature.verify(javaArray);if(result.isValid()){console.log('\nDocumentwasverifiedsuccessfully!');}else{console.log('\nDocumentfailedtheverificationprocess.');}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in ourΒ GitHub examples: