PdfForm Object
Overview
PdfForm represents an interactive form associated with this document. PdfForm is obtainable via PdfDocument's Form property. For more information on interactive forms, see Chapter 11 - Forms.
Member List
Properties
Returns a PdfAnnots collection of PdfAnnot objects representing individual top-level form fields.
Returns True if the PDF form contains XFA data. Otherwise returns False. This property was introduced in Version 3.0.
For more information, see Section 12.7 - XFA Support.
Returns or specifies a flag controlling whether to construct appearances for all form fields in the document. False by default.
Returns or specifies signature flags. The following flag bits are defined:
Bit 1: If set, the document contains at least one signature field.
Bit 2: If set, the document contains signatures that may be invalidated if the file is saved (written) in a way that alters its previous contents (such as with the "optimize" option). Merely updating the file by appending new information to the end of the previous version is safe.
Returns or specifies the PDF form's XFA dataset in XML format. Can only be used if the HasXFA property returns True. This property was introduced in Version 3.0.
For more information, see Section 12.7 - XFA Support.
Returns the PDF form's XFA template in XML format. Can only be used if the HasXFA property returns True. This property was introduced in Version 3.0.
For more information, see Section 12.7 - XFA Support.
Methods
Finds and returns a top-level form field specified by Name. If no fields under this name are found, the method returns Nothing.
This method is useful for automatic form fill-out purposes.
The Form Field Finder online application enables you to determine which field names your PDF form supports.
Usage:
Set Doc = Pdf.OpenDocument("c:\1040nr.pdf")
Set Field = Doc.Form.FindField("txtFirstName")
Field.SetFieldValue "John", fontFor more information, see Chapter 12 - Existing Form Fill-in.
Flattens the form, i.e. turns all of its interactive fields into static graphics. This method should only be called on an already filled-in form. This method was introduced in Version 2.6.
Usage:
Set Doc = Pdf.OpenDocument("c:\path\1040nr.pdf")
Doc.Form.Flatten
Doc.Save "c:\path\flattened.pdf"For more information, see Section 12.5 - Form Flattening.
Performs various operations on the form based on the specified parameters.
Param is a PdfParam object or parameter string containing various Boolean parameters, all optional, including:
- RemoveXFA - this parameter is equivalent to calling the RemoveXFA method.
- Flatten - this parameter is equivalent to calling the Flatten method.
- FlattenAnnots - this parameter flattens items that are not technically form fields but field-like annotations.
- RemoveJavaScript - this parameter removes all JavaScript from the document's catalog. This prevents the message "This PDF form requires a newer version of Adobe Acrobat" from popping up.
- Reset - this parameter resets the current graphics state for all pages of the document. This may be useful if the flattening procedure produces unexpected output or no output at all. This parameter was introduced in Version 3.4.0.2.
This method was introduced in Version 2.9.
Usage:
Set Doc = Pdf.OpenDocument("c:\path\1040nr.pdf")
Doc.Form.Modify "Flatten=true; RemoveJavaScript=true"
Doc.Save "c:\path\flattened.pdf"For more information, see Section 12.6 - JavaScript Removal and Other Features.
Removes the XML Forms Architecture (XFA) information from an existing form. This method was introduced by Version 1.5.0.1 as a temporary workaround addressing partial incompatibility between AspPDF 1.5 and forms created by Adobe Designer 7.0.
Usage:
Set Doc = Pdf.OpenDocument("c:\1040nr.pdf")
Doc.Form.RemoveXFA' Fill in the form
...
For more information, see Section 12.2 - Adobe Acrobat 7/Designer 7 Issues.