Click or drag to resize
Pdf Library for .NET

Form Filling

SelectPdf can be used to open existing PDF documents that contain AcroForms form fields, get information about the form fields (name, type, value, status) fill the form fields and change some of their properties (like read-only or flatten).

This can be done using PdfFormManager object. Using it, the list of fields can be accessed through the Fields property. The following types of fields can be handled by SelectPdf:

For all form fields, the following properties can be accessed:

  • Name - Gets or sets the name of the field.

  • ReadOnly - Gets or sets a value indicating whether the field is read-only or not.

  • Flatten - Gets or sets a value indicating whether to flatten this form field or not.

The whole PDF form can be marked as read-only or flattened using the properties ReadOnly or Flatten.

Code Sample
// load the pdf form manager
PdfFormManager form = new PdfFormManager();
form.Load(file);

// fill some fields
PdfFormFieldTextBox txtField = form.Fields["textfieldname"] as PdfFormFieldTextBox;
txtField.Text = "Some text";

PdfFormFieldCheckBox chkField = form.Fields["checkboxfieldname"] as PdfFormFieldCheckBox;
chkField.Checked = true;

// save pdf document
form.Save("Sample.pdf");

// close pdf document
form.Close();
See Also