GroupDocs.Signature provides the ability to search for image electronic signatures in documents. Image signatures allow you to add visual elements like logos, stamps, or handwritten signatures to your documents.
What is an Image Signature?
An image signature is a graphical element that can be added to a document to represent a signature. It can be:
A scanned handwritten signature
A company logo
A stamp or seal
Any other graphical element used for signing
How to Search for Image Signatures
The Signature class provides the Search method which allows you to search for image signatures in documents. Here’s how to use it:
Create a new instance of the Signature class and pass the source document path as a parameter.
Call the Search method of the Signature class instance and pass the search options to it.
Process the search results.
Here’s an example of how to search for image signatures in a document:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportImageSearchOptionsfromgroupdocs.signature.domainimportImageSignature# Initialize Signature with input documentwithSignature("sample.pdf")assignature:# Create search optionssearch_options=ImageSearchOptions()# Search for signaturesresult=signature.search(search_options)# Process found signaturesprint(f"Found {len(result)} image signatures")forimage_signatureinresult:print(f"Page: {image_signature.page_number}")print(f"Position: X={image_signature.left}, Y={image_signature.top}")print(f"Size: Width={image_signature.width}, Height={image_signature.height}")
Advanced Search Options
You can customize the search process by setting specific options:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportImageSearchOptionsfromgroupdocs.signature.domainimportImageSignature# Initialize Signature with input documentwithSignature("sample.pdf")assignature:# Create search optionssearch_options=ImageSearchOptions()# Set search criteriasearch_options.page_number=1# Search on specific pagesearch_options.all_pages=False# Search only on specified page# Search for signaturesresult=signature.search(search_options)# Process found signaturesprint(f"Found {len(result)} image signatures")forimage_signatureinresult:print(f"Page: {image_signature.page_number}")print(f"Position: X={image_signature.left}, Y={image_signature.top}")print(f"Size: Width={image_signature.width}, Height={image_signature.height}")
Additional Resources
GitHub Examples
You may easily run the code above and see the feature in action in our examples: