Click or drag to resize
Pdf Library for .NET

PdfFormManager Class

This class provides the options to control the pdf document form fields. It can be used to fill the existing form fields and save the pdf document.
Inheritance Hierarchy
SystemObject
  SelectPdfPdfManager
    SelectPdfPdfFormManager

Namespace:  SelectPdf
Assembly:  Select.Pdf (in Select.Pdf.dll) Version: 24.1
Syntax
public class PdfFormManager : PdfManager

The PdfFormManager type exposes the following members.

Constructors
  NameDescription
Public methodPdfFormManager
Instantiates the PdfFormManager object.
Top
Properties
  NameDescription
Public propertyFields
Collection of pdf form fields from the current pdf document.
Public propertyFlatten
Gets or sets a value indicating whether to flatten the pdf form or not.
Public propertyReadOnly
Gets or sets a value indicating whether the pdf form is read-only or not.
Top
Methods
  NameDescription
Public methodClose
Closes the opened pdf document.
(Inherited from PdfManager.)
Public methodGetDocument
Returns the pdf document as PdfDocument object.
(Inherited from PdfManager.)
Public methodLoad(Byte)
Loads a pdf document from a byte array.
(Inherited from PdfManager.)
Public methodLoad(Stream)
Loads a pdf document from the specified stream.
(Inherited from PdfManager.)
Public methodLoad(String)
Loads a pdf document from an existing pdf file.
(Inherited from PdfManager.)
Public methodLoad(PdfDocument)
Loads a pdf document from an existing PdfDocument object.
(Inherited from PdfManager.)
Public methodLoad(Byte, String)
Loads a password protected pdf document from a byte array.
(Inherited from PdfManager.)
Public methodLoad(Stream, String)
Loads a pdf document from a stream containing a password protected pdf document.
(Inherited from PdfManager.)
Public methodLoad(String, String)
Loads a pdf document from an existing password protected pdf file.
(Inherited from PdfManager.)
Public methodLoad(PdfDocument, String)
Loads a pdf document from an existing password protected PdfDocument object.
(Inherited from PdfManager.)
Public methodSave
Saves the pdf document as byte array.
(Inherited from PdfManager.)
Public methodSave(Stream)
Saves the pdf document to the specified stream.
(Inherited from PdfManager.)
Public methodSave(String)
Saves the pdf document to the specified file.
(Inherited from PdfManager.)
Top
Examples
The following sample code shows how the form manager can be instantiated and some fields filled:
// the initial file
string file = Server.MapPath("~/files/w-9.pdf");

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

// fill some fields
PdfFormFieldTextBox name = 
    form.Fields["f1_1"] as PdfFormFieldTextBox;
name.Text = "This is my name";

PdfFormFieldTextBox businessName = 
    form.Fields["f1_2"] as PdfFormFieldTextBox;
businessName.Text = "This is my business name";

PdfFormFieldCheckBox clasifIndividual =
    form.Fields["c1_1"] as PdfFormFieldCheckBox;
clasifIndividual.Checked = true;

PdfFormFieldTextBox address =
    form.Fields["f1_7"] as PdfFormFieldTextBox;
address.Text = "This is my address";

PdfFormFieldTextBox city =
    form.Fields["f1_8"] as PdfFormFieldTextBox;
city.Text = "This is my city";

PdfFormFieldTextBox employer1 =
    form.Fields["f1_14"] as PdfFormFieldTextBox;
employer1.Text = "XX";

PdfFormFieldTextBox employer2 =
    form.Fields["f1_15"] as PdfFormFieldTextBox;
employer2.Text = "1234567";

PdfFormFieldTextBox ssn1 =
    form.Fields["f1_11"] as PdfFormFieldTextBox;
ssn1.Text = "123";

PdfFormFieldTextBox ssn2 =
    form.Fields["f1_12"] as PdfFormFieldTextBox;
ssn2.Text = "45";

PdfFormFieldTextBox ssn3 =
    form.Fields["f1_13"] as PdfFormFieldTextBox;
ssn3.Text = "6789";

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

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