Forms Extension

Forms Processing

Working with the Forms Extension

With the Forms Extension installed, the Adobe PDF Library can:

  1. Render an XFA PDF form document as it would any other PDF document. The Library can generate all of the pages in the document, and annotation appearances are also rendered in the output file. Effectively the XFA form is rendered as a PDF AcroForm file.
  2. Generate appearances for annotations in PDF documents. Every annotation included in a PDF document features an optional entry that describes what the annotation will look like (appearance) when the document is rendered in a viewer. If the value is not provided in the PDF file, when opened in Adobe Acrobat, Acrobat will fill in the appearance, based on what the value should be.Many PDF annotations appear as a polygon in a PDF document with a simple border and color scheme, but these annotations are designed to change in appearance depending on how the user interacts with it. For example, a link to an external web site would probably appear in blue on a PDF page. If you point the cursor at that link, the color might change to grey temporarily, while the link is highlighted.  After clicking on that link, the link might change to red.
  3. Render PDF AcroForm form documents, including the appearances for form fields. Without the Forms Extension, Adobe PDF Library can open PDF AcroForm documents but it does not render them accurately.
  4. Render a wide variety of bar codes specified in the forms data.
  5. Flatten AcroForm and XFA PDF form documents, converting them into standard PDF documents. The interactive field content in the form is turned into PDF page content.
  6. Import content from a source file into an XFA or AcroForm form document, or export content from the fields in an XFA or AcroForm form document to a file. FDF, XML, and XFDF files can be used to import data into AcroForm documents or export data from those documents. FDF refers to Forms Data Format, a file format described in the PDF specification. FDF files use the same low-level syntax as PDF, but the FDF format is only used to describe the content found in PDF annotations and form fields. XFDF is an XML version of the FDF format. XML files can be used to import content into and export content from XFA forms documents, or XDP documents (XML Data Package).
  7. Convert an XFA form document into an AcroForm document.

After converting a document from XFA to AcroForm, or after flattening an XFA document, save it in order to update the file permissions. This is needed to continue working with the document.

Java and .NET Interfaces

The Forms Extension includes APIs for processing AcroForm and XFA forms documents for the core Adobe PDF Library as well as for Java and .NET (C#).

These APIs are provided to work with the Java and .NET interface of the Adobe PDF Library:

  • IsFormsExtensionAvailable() in the Library class
  • FlattenXFAFormFields() in the Document class
  • FlattenXFAFormFieldsAsIfPrinted() in the Document class
  • FlattenAcroFormFields() in the Document class
  • ConvertXFAFieldsToAcroFormFields() in the Document class
  • ExportXFAFormsData() in the Document class
  • ImportXFAFormsData() in the Document class
  • ExportAcroFormsData() in the Document class
  • ImportAcroFormsData() in the Document class
  • IsDynamicXFA() in the Document class
  • IsStaticXFA() in the Document class
  • InitFormsExtension value of the LibraryFlags enumeration

Sample Programs

We provide a set of eight sample programs with the Forms Extension to demonstrate working with PDF form documents:

  • Converting an XFA form document to AcroForm
  • Flattening PDF forms, to remove interactive features
  • Importing data into or exporting data out of XFA and AcroForm form documents

These samples are also available for free download from our public github repository, adobe-pdf-library-samples.

Note that the program files available on this repository are only available for your review. You can’t run these sample programs without both Adobe PDF Library and the Forms Extension installed.

The samples are provided in C++ and Java:

  • ConvertXFAToAcroForms
  • FlattenForms
  • ImportFormsData
  • ExportFormsData