Click or drag to resize

PdfForm Class

A PdfForm represents a collection of fields that may be entered by a user for later collection or submission. A form is a hierarchy of form elements ending in nodes which are always BaseWidgetAnnotation object. For the widgets to be visible to the user, they must also be put into the Annotations collection in a PdfGeneratedPage.
Inheritance Hierarchy
SystemObject
  Atalasoft.PdfDoc.Generating.FormsPdfForm

Namespace:  Atalasoft.PdfDoc.Generating.Forms
Assembly:  Atalasoft.PdfDoc (in Atalasoft.PdfDoc.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
public class PdfForm : IValidatable, IDisposable

The PdfForm type exposes the following members.

Constructors
  NameDescription
Public methodPdfForm
Initializes a new instance of the PdfForm class
Top
Properties
  NameDescription
Public propertyDefaultAppearance
Gets or sets the default text appearance for all child fields in the form (if not otherwise specified)..
Public propertyFieldCalculationSequence
Gets the field calculation sequence. If form fields contain a field calculation, the order of calculation can be specified by this list. A PDF viewer will perform the recalculation based on the order of this list.
Public propertyFields
Gets the fields present in this form. Any BaseWidgetAnnotation objects in the Fields tree must also be contained in an Annotations collection on a page in the document.
Public propertyFormHasSignatures
Gets a value indicating whether form has signature fields.
Public propertyIsEmpty
Gets a value indicating whether there are any fields in this form.
Public propertySavingWillInvalidateSignatures
Gets a value indicating whether saving the document will invalidate signatures.
Public propertyTextAlignment
Gets or sets the text alignment for all child fields in the form (if not otherwise specified).
Public propertyCode exampleXFA
Gets a collection of StoredStream objects that represent packets of XFA data contained within a PDF Document. Each StoredStream will contain XML data that represents the XFA data. XFA may be contained within a single stream or within a collection of packets, each of which represents a subsection of the XFA model.
Top
Methods
  NameDescription
Public methodContainsFormElement
Determines whether this form contains the given IFormElement
Public methodDispose
Releases all resources used by the PdfForm
Protected methodDispose(Boolean)
Releases the unmanaged resources used by the PdfForm and optionally releases the managed resources
Public methodEnforceParentage
Enforces the parent/child relationships in form elements within a form field hierarchy. This is done by doing a breadth-first traversal of all form elements and forcing the child elements to point back to the parent. Calling this method will ensure that FieldFullName will return the correct value. Before saving a document or validation this method will get called automatically. Calling this method will ensure that the FieldFullName property returns the correct value.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberIsFieldLeaf
Determines whether a give IFormElement is a leaf or a node.
Public methodMakeRepairContext
Makes the repair context for repairing problems in this object. An object implementing IValidatable should at least return an empty RepairContext object. PdfForm does not require an object passed in.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodValidate
Validates the object looking for problems.
Top
Examples
Here is an example that makes a simple form.
PdfGeneratedDocument doc = new PdfGeneratedDocument();
doc.Form = new PdfForm();
PdfGeneratedPage page = doc.AddPage(PdfDefaultPages.Letter);
TextWidgetAnnotation text = new TextWidgetAnnotation(new PdfBounds(72, 400, 200, 20), "name", null);
page.Annotations.Add(text);
doc.Form.Fields.Add(text);
doc.Save("output.pdf");
See Also