eSign document with Form Field signature
What is a Form Field?
A form field is the interactive element located on document page that allows user data input through various control types like free input text box, multi-line text box, check boxes, drop down lists etc. Different document types support specific list of form field types. These elements are used to collect information from user on template form. Each Form Field element has an unique name, settings and value field. Form Fields should have unique names within the form. Picture below demonstrates possible document page with form fields.
How to eSign document with Form Field signature
GroupDocs.Signature for Java supports creation of new form fields or update existing ones within the documents. Class FormFieldSignOptions specifies different options for Form Field signature.
The FormFieldSignOptions class contains one FormFieldSignature object to put to the document.
Here are the list of different Form Field signature classes that could be set to FormFieldSignOptions
- TextFormFieldSignature - represents text input form field on document page.
- CheckboxFormFieldSignature - represents check box field on the document page.
- DigitalFormFieldSignature - represents digital signature input form on document page.
Here are the steps to add Form Field signatures into document with GroupDocs.Signature:
- Create new instance of Signature class and pass source document path as a constructor parameter;
- Instantiate the FormFieldSignOptions object according to your requirements;
- Instantiate one of the objects - TextFormFieldSignature, CheckboxFormFieldSignature or DigitalFormFieldSignature;
- Set FormFieldSignOptions Signature property with created object;
- Call sign method of Signature class instance and pass FormFieldSignOptions to it.
NOTE: At the moment GroupDocs.Signature supports creation of Form Field signatures for PDF documents only.
This example shows how to sign PDF document with Form Field electronic signature on document page.
Signature signature = new Signature("sample.pdf"); // instantiate text form field signature FormFieldSignature textSignature = new TextFormFieldSignature("FieldText", "Value1"); // instantiate options based on text form field signature FormFieldSignOptions options = new FormFieldSignOptions(textSignature); options.setHorizontalAlignment(HorizontalAlignment.Left); options.setVerticalAlignment(VerticalAlignment.Top); options.setMargin(new Padding(10, 20, 0, 0)); options.setHeight(10); options.setWidth(100); // sign document to file signature.sign("signed.pdf", options);
Advanced Usage Topics
To learn more about document eSign features, please refer to the advanced usage section.
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Signature for .NET examples, plugins, and showcase
- GroupDocs.Signature for Java examples, plugins, and showcase
- Document Signature for .NET MVC UI Example
- Document Signature for .NET App WebForms UI Example
- Document Signature for Java App Dropwizard UI Example
- Document Signature for Java Spring UI Example
Free Online App
Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.