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 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.

            // The path to the documents directory.
            string filePath = "sample.pdf";
            string fileName = Path.GetFileName(filePath);

            string outputFilePath = Path.Combine("C:\output", fileName);

            using (Signature signature = new Signature(filePath))
            {
                // Instantiate text form field signature
                FormFieldSignature textSignature = new TextFormFieldSignature("FieldText", "Value1");

                // Instantiate options based on text form field signature
                FormFieldSignOptions options = new FormFieldSignOptions(textSignature)
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Top,
                    Margin = new Padding(10, 20, 0, 0),
                    Height = 10,
                    Width = 100
                };
                // Sign document and save to the file
                signature.Sign(outputFilePath, options);
            }

How to eSign document with existing Form Field signatures

GroupDocs.Signature for .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.

// The path to the documents directory.
string filePath = "sample.pdf";
string fileName = Path.GetFileName(filePath);

string outputFilePath = Path.Combine("C:\output", fileName);

using (Signature signature = new Signature(filePath))
{
    TextSignOptions ffOptions1 = new TextSignOptions("Document is approved")
    {
        // set alternative signature implementation on document page
        SignatureImplementation = TextSignatureImplementation.FormField,
        FormTextFieldType = FormTextFieldType.PlainText
    };
    TextSignOptions ffOptions2 = new TextSignOptions("John Smith")
    {
        // set alternative signature implementation on document page
        SignatureImplementation = TextSignatureImplementation.FormField,
        FormTextFieldType = FormTextFieldType.RichText,
        FormTextFieldTitle = "UserSignatureFullName"
    };
    List<SignOptions> listOptions = new List<SignOptions>();
    listOptions.Add(ffOptions1);
    listOptions.Add(ffOptions2);
    // sign document to file
    SignResult signResult = signature.Sign(outputFilePath, listOptions);
}

Summary

This guide explains how to use GroupDocs.Signature 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.

Advanced Usage Topics

To learn more about document eSign features, please refer to the advanced usage section.

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 .NET 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.