Search for Form Field e-Signatures

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:

  1. Create a new instance of the Signature class and pass the source document path as a parameter.
  2. Create an instance of FormFieldSearchOptions class.
  3. Call the search method of the Signature class instance and pass a list with the search options to it.
  4. 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:

from groupdocs.signature import Signature
from groupdocs.signature.options import FormFieldSearchOptions


def search_form_fields():
    with Signature("signed.pdf") as signature:
        result = signature.search([FormFieldSearchOptions()])

        print(f"Found {len(result.signatures)} form field signature(s)")
        for field in result.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

Download full output

Advanced Search Options

You can customize the search process with the name, type (FormFieldType) and value properties of FormFieldSearchOptions:

from groupdocs.signature import Signature
from groupdocs.signature.domain import FormFieldType
from groupdocs.signature.options import FormFieldSearchOptions


def search_form_fields_by_name():
    with Signature("signed.pdf") as signature:
        options = FormFieldSearchOptions()
        # Return only text fields named "ApprovedBy"
        options.type = FormFieldType.TEXT
        options.name = "ApprovedBy"

        result = signature.search([options])

        print(f"Found {len(result.signatures)} matching form field signature(s)")
        for field in result.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

Download full output

More Resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Apps

Along with the full-featured Python library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.