10/24/2017 - 8:22 AM

// For complete examples and data files, please go to
// setup Signature configuration 
SignatureConfig signConfig = CommonUtilities.getConfiguration(); 
// instantiating the conversion handler
SignatureHandler<String> handler = new SignatureHandler<String>(signConfig);
// setup digital verification options
PDFVerifyTextOptions verifyOptions = new PDFVerifyTextOptions();
// specify verification type
// verify only page with specified number
// verify all pages of a document if true
//If verify option Text is set, it will be searched in Title, Subject and Contents
verifyOptions.setText("John Smith_1");
// create Verify Extensions
PdfTextAnnotationVerifyExtensions extensions = new PdfTextAnnotationVerifyExtensions();
//If verify option is set, then appropriate property of Annotation must be equals
extensions.setContents("John Smith_1");
extensions.setSubject("John Smith_2");
extensions.setTitle("John Smith_3");
// set extensions to verification options
//verify document
VerificationResult result = handler.verify(CommonUtilities.getStoragePath(fileName), verifyOptions);
System.out.println("Signed file verification result: " + result.isValid());