eSign Document with Form Field Signature

What is a Form Field?

A form field is an interactive element located on a document page that allows user data input through various control types like free input text boxes, multi-line text boxes, checkboxes, drop-down lists, etc. Different document types support a specific list of form field types. These elements are used to collect information from users on template form. Each Form Field element has a unique name, settings and value field. Form Fields should have unique names within the form. The picture below demonstrates a possible document page with form fields.

FormField

How to eSign Document with Form Field Signature

With GroupDocs.Signature for Python via .NET you can create new form fields or update the existing ones within the documents. The FormFieldSignOptions class specifies different options for Form Field signature. The FormFieldSignOptions class contains one FormFieldSignature object that specifies the properties of the desired signature.

Below are listed different Form Field signature classes that could be set to FormFieldSignOptions:

Here are the steps to add Form Field signatures into a document with GroupDocs.Signature:

Note
Currently GroupDocs.Signature supports the creation of Form Field signatures for PDF documents only.

This example shows how to sign a PDF document with a Form Field electronic signature using Python:

import groupdocs.signature as signature
from groupdocs.signature.options import FormFieldSignOptions
from groupdocs.signature.domain import TextFormFieldSignature
import groupdocs.signature.domain as gsd
import sys 
import os

def run():
    with signature.Signature("./sample.pdf") as sign:
        # Create text form field signature
        text_signature = TextFormFieldSignature("FieldText", "Value1")
        
        # Create form field options
        options = FormFieldSignOptions(text_signature)
        
        # Set signature position and size
        options.horizontal_alignment = gsd.HorizontalAlignment.LEFT
        options.vertical_alignment = gsd.VerticalAlignment.TOP
        options.margin = gsd.Padding(10, 20, 0, 0)
        options.height = 10
        options.width = 100
        
        # Sign document
        sign.sign("./SampleSigned.pdf", options)

How to eSign Document with Existing Form Field Signatures

GroupDocs.Signature for Python via .NET also provides a mechanism to update the existing form field signatures within the documents.

To update an existing form field signature within the document with GroupDocs.Signature:

This example shows how to sign a PDF document with the existing Form Field electronic signature and update its value using Python:

import groupdocs.signature as signature
from groupdocs.signature.options import TextSignOptions
from groupdocs.signature.domain import FormTextFieldType

# Initialize signature
with signature.Signature("sample.pdf") as sign:
    # Create first form field options
    ff_options1 = TextSignOptions("Document is approved")
    ff_options1.signature_implementation = signature.TextSignatureImplementation.FORM_FIELD
    ff_options1.form_text_field_type = FormTextFieldType.PLAIN_TEXT
    
    # Create second form field options
    ff_options2 = TextSignOptions("John Smith")
    ff_options2.signature_implementation = signature.TextSignatureImplementation.FORM_FIELD
    ff_options2.form_text_field_type = FormTextFieldType.RICH_TEXT
    ff_options2.form_text_field_title = "UserSignatureFullName"
    
    # Create list of options
    list_options = [ff_options1, ff_options2]
    
    # Sign document
    sign_result = sign.sign("SampleSigned.pdf", list_options)

Summary

This guide explains how to use GroupDocs.Signature for Python via .NET to add form field signatures to documents. It covers loading a document, configuring form field properties such as name, type, and value, and saving the signed document. Advanced options, like customizing field appearance and placement, are also included. For more details, refer to related guides on document signing techniques.

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 documents for free, you can use the Digital Signature - PDF online application.

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