GroupDocs.Signature provides the ability to search for form field electronic signatures in documents. Form field signatures allow you to add interactive form elements like text boxes, checkboxes, and radio buttons to your documents.
How to Search for Form Field Signatures
The Signature class provides the Search method which allows you to search for form field 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 form field signatures in a document:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportFormFieldSearchOptionsfromgroupdocs.signature.domainimportFormFieldSignature# Initialize Signature with input documentwithSignature("sample.pdf")assignature:# Create search optionssearch_options=FormFieldSearchOptions()# Search for signaturesresult=signature.search(search_options)# Process found signaturesprint(f"Found {len(result)} form field signatures")forform_field_signatureinresult:print(f"Page: {form_field_signature.page_number}")print(f"Field Name: {form_field_signature.name}")print(f"Field Type: {form_field_signature.field_type}")print(f"Field Value: {form_field_signature.value}")
Advanced Search Options
You can customize the search process by setting specific options:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportFormFieldSearchOptionsfromgroupdocs.signature.domainimportFormFieldSignature# Initialize Signature with input documentwithSignature("sample.pdf")assignature:# Create search optionssearch_options=FormFieldSearchOptions()# Set search criteriasearch_options.page_number=1# Search on specific pagesearch_options.all_pages=False# Search only on specified pagesearch_options.field_name="signature"# Search for specific field name# Search for signaturesresult=signature.search(search_options)# Process found signaturesprint(f"Found {len(result)} form field signatures")forform_field_signatureinresult:print(f"Page: {form_field_signature.page_number}")print(f"Field Name: {form_field_signature.name}")print(f"Field Type: {form_field_signature.field_type}")print(f"Field Value: {form_field_signature.value}")
Additional Resources
GitHub Examples
You may easily run the code above and see the feature in action in our examples: