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 a list with the search options to it.
Process the search results: the signatures property of the returned SearchResult holds the found FormFieldSignature objects.
Here’s an example of how to search for form field signatures in a document. A PDF digital signature is kept in a signature form field, so it is listed too, with the DIGITAL_SIGNATURE type:
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.optionsimportFormFieldSearchOptionsdefsearch_form_fields():withSignature("signed.pdf")assignature:result=signature.search([FormFieldSearchOptions()])print(f"Found {len(result.signatures)} form field signature(s)")forfieldinresult.signatures:print(f"Page {field.page_number}: {field.type.name} field {field.name!r}, value: {field.value!r}")if__name__=="__main__":search_form_fields()
signed.pdf is the sample file used in this example. Click here to download it.
Found 3 form field signature(s)
Page 1: TEXT field 'ApprovedBy', value: 'John Smith'
Page 1: CHECKBOX field 'Confirmed', value: True
Page 1: DIGITAL_SIGNATURE field None, value: None
fromgroupdocs.signatureimportSignaturefromgroupdocs.signature.domainimportFormFieldTypefromgroupdocs.signature.optionsimportFormFieldSearchOptionsdefsearch_form_fields_by_name():withSignature("signed.pdf")assignature:options=FormFieldSearchOptions()# Return only text fields named "ApprovedBy"options.type=FormFieldType.TEXToptions.name="ApprovedBy"result=signature.search([options])print(f"Found {len(result.signatures)} matching form field signature(s)")forfieldinresult.signatures:print(f"Field '{field.name}' on page {field.page_number}, value: {field.value}")if__name__=="__main__":search_form_fields_by_name()
signed.pdf is the sample file used in this example. Click here to download it.
Found 1 matching form field signature(s)
Field 'ApprovedBy' on page 1, value: John Smith