Sign PDF with Form Field Signatures using C#

Form Fields are various types of data fields that are used to collect information from the users. As a C# developer, you can easily create PDF documents to be filled and signed by users electronically. This can be helpful in collecting customer feedback, partners’ consent, etc. In this article, you will learn how to electronically sign PDF documents with Form Field signatures using C#.

The following topics are discussed/covered in this article:

C# API for Signing PDF Documents

I will be using GroupDocs.Signature for .NET API for signing the PDF documents enabled with form field signatures. The API allows you to add digital signatures to the supported document formats and implement popular electronic signature types in your .NET Applications. It also enables you with simple and advanced search options to locate your required signatures on a document.

Sign PDF Documents with Form Field Signatures using C#

You can electronically sign your PDF documents using the following types of form field signatures programmatically:

Sign PDF Documents with Text Form Field Signatures

You can sign PDF documents with Text form field signatures by following the simple steps mentioned below:

  • Create an instance of the Signature class
  • Provide path of the input PDF document
  • Create an instance of the TextFormFieldSignature class
  • Create an instances of the FormFieldSignOptions class with TextFormFieldSignature object
  • Set required sign options such as Margin, Height, Width, etc.
  • Call the Sign() method with the FormFieldSignOptions and output file path

The following code sample shows how to electronically sign a PDF document with text form field signatures using C#.

The Signature class is the main class that controls the document signing process. It provides various methods to sign, search, delete or verify signatures in a document. The Sign() method of this class is used to sign the document with defined SignOptions.

The TextFormFieldSignature class provides text input form field signature properties for the PDF Documents.

Sign PDF Documents with Radio Button Form Field Signatures

You can sign PDF documents with the radio button form field signatures by following the steps mentioned earlier. However, you need to create an instance of RadioButtonFormFieldSignature class instead of TextFormFieldSignature.

The following code sample shows how to electronically sign a PDF document with radio button form field signatures using C#.

The RadioButtonFormFieldSignature class provides radio-button input form field signature properties for the PDF Documents.

Sign PDF Documents with Combobox Form Field Signatures

You can sign PDF documents with Combobox form field signatures by following the steps mentioned earlier. However, you need to create an instance of ComboboxFormFieldSignature instead of TextFormFieldSignature.

The following code sample shows how to electronically sign a PDF document with Combobox form field signatures using C#.

The ComboboxFormFieldSignature class provides combo-box input form field signature properties for the PDF Documents.

Sign PDF Documents with Checkbox Form Field Signatures

You can sign PDF documents with Checkbox form field signatures by following the same steps mentioned earlier. However, you need to create an instance of CheckboxFormFieldSignature instead of TextFormFieldSignature.

The following code sample shows how to electronically sign a PDF document with checkbox form field signatures.

The CheckboxFormFieldSignature class provides check-box input form field signature properties for the PDF Documents.

Sign PDF Documents with Digital Form Field Signatures

You can sign PDF documents with digital form field signatures by following the same steps mentioned earlier. However, you need to create an instance of DigitalFormFieldSignature instead of TextFormFieldSignature.

The following code sample shows how to electronically sign a PDF document with digital form field signatures.

The DigitalFormFieldSignature class provides digital signature input form field properties for the PDF Documents. The user shall be able to sign documents with his own digital signatures in this field.

Sign PDF Documents with Multiple Form Field Signatures using C#

You can electronically sign your PDF documents with multiple form field signatures programmatically by following the simple steps mentioned below:

  • Create an instance of the Signature class
  • Provide path of the input PDF document
  • Define a list of the SignOptions
  • Create the FormFieldSignature objects
  • Create instances of the FormFieldSignOptions for the created FormFieldSignature objects
  • Set required sign options such as position (Margin, Height, Width, etc.) for each object
  • Add FormFieldSignOptions objects to the SignOptions list
  • Call the Sign() method with the SignOptions and output file path

The following code sample shows how to electronically sign a PDF document with multiple form field signatures using C#.

Sign PDF Documents with Multiple Form Field Signatures using C#

Sign PDF Documents with Multiple Form Field Signatures using C#

The Sign() method of the Signature class is used to sign the document with a list of SignOptions. The SignOptions class allows setting the signature options such as appearance, signature types, etc.

The FormFieldSignOptions class provides the Form Field signature options for the PDF documents. You can define the form field options such as HorizontalAlignment, VerticalAlignment, Margin, Height, and Width. You need to provide the defined object of one of the FormFieldSignature classes while creating the instance of the FormFieldSignOptions class.

Get a Free License

You can try the API without evaluation limitations by requesting a free temporary license.

Conclusion

In this article, you have learned how to create a PDF with Form Field Signatures using C#. You have also learned how to electronically sign PDF documents with various Form Field Signature types programmatically. You can learn more about GroupDocs.Signature for .NET API using the documentation. In case of any ambiguity, please feel free to contact us on the forum.

See Also