Search for multiple e-signature types
Sometimes you may want to search for electronic signatures of different types simultaneously. GroupDocs.Signature allows searching documents for different signature types in an easy and intuitive way. In common words the idea is to pass collection of desired signature types to Search method.
Here are the steps to search for multiple signatures types within the document with GroupDocs.Signature:
Create new instance of Signature class and pass source document path as a constructor parameter.
Instantiate search options for required signature types and them to collection of List<SearchOptions> type. The possible options are:
BarcodeSearchOptions - to search for Barcode signatures;
DigitalSearchOptions - to search for Digital signatures;
FormFieldSearchOptions - to search for Form-field signatures;
ImageSearchOptions - to search for Image signatures;
MetadataSearchOptions - to search for Metadata signatures;
QrCodeSearchOptions - to search for QR-code signatures;
TextSearchOptions to search for Text signatures.
Call search method of Signature class instance and pass collection of search options to it.
This example shows how to search for multiple electronic signature types in the document.
Signature signature = new Signature("SingedSample.pdf");
BarcodeSearchOptions barcodeOptions = new BarcodeSearchOptions();
barcodeOptions.setAllPages(true);
barcodeOptions.setEncodeType(BarcodeTypes.Code128);
QrCodeSearchOptions qrCodeOptions = new QrCodeSearchOptions();
qrCodeOptions.setAllPages(true);
qrCodeOptions.setEncodeType(QrCodeTypes.QR);
qrCodeOptions.setText("John");
qrCodeOptions.setMatchType(TextMatchType.Contains);
MetadataSearchOptions metadataOptions = new MetadataSearchOptions();
metadataOptions.setAllPages(true);
metadataOptions.setIncludeBuiltinProperties(true);
// add options to list
List<SearchOptions> listOptions = new ArrayList<SearchOptions>();
listOptions.add(barcodeOptions);
listOptions.add(qrCodeOptions);
listOptions.add(metadataOptions);
// search for signatures in document
SearchResult result = signature.search(listOptions);
if (result.getSignatures().size() > 0)
{
System.out.print("\nSource document contains following signatures.");
for (BaseSignature resSignature : result.getSignatures())
{
System.out.print("Signature found at page "+resSignature.getPageNumber()+" with type "+resSignature.getSignatureType());
}
}
else
{
System.out.print("No one signature was found.");
}
More resources
Advanced Usage Topics
To learn more about document eSign features, please refer to the advanced usage section.
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Signature for .NET examples, plugins, and showcase
- GroupDocs.Signature for Java examples, plugins, and showcase
- Document Signature for .NET MVC UI Example
- Document Signature for .NET App WebForms UI Example
- Document Signature for Java App Dropwizard UI Example
- Document Signature for Java Spring UI Example
Free Online App
Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.