With a PDF form document, a user can open the PDF file, enter information, and save the document with the new content. The user can enter text, select options from a menu, click check boxes or radio buttons, or complete other form field elements. It is also possible to add a digital signature to a form document, provide a bar code, and lock the fields in a form after the fields are completed and the document is saved.
Adobe PDF Library provides this set of sample programs 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
Note that you can’t use these sample programs, or complete the tasks that these samples represent, without installing the Forms Extension. This module is available for separate purchase.
This sample program demonstrates how to convert a dynamic or static XFA to an AcroForm document. The form fields in the source XFA document are converted to AcroForm fields, and the XFA fields are removed.
The FlattenForms sample program demonstrates how to Flatten XFA and AcroForm documents into standard PDF files.
The flattening process, in working with PDF documents, combines layers of content on a PDF page, or a stack of transparent images or colors, or an annotation, and renders the result as a single image, color, or set of text. When applied to a PDF form document, either XFA or AcroForm, the content in the form fields appears in the output file as regular text, and the interactive features of these form fields are removed. It is no longer possible to change the values in the form fields. If the form document includes a digital signature, the digital certificate key and related properties are removed from the signature field. The name of the person who signed the document and related information, such as the date and time stamp and the signer’s email address, appear on the page as text, but the signature field is no longer presented as an annotation. And any type of bar code included on the form are also flattened, other than bar codes rendered from hardware or printers.
If you run the program from the command line you can define the name of the output file.
The ImportFormsData sample demonstrates how to Import forms data into an AcroForm document and an XFA form document. This process allows you to partially complete a PDF form document or set of form documents, either with standard data, such as the name and address of an agent, or with a specific customer’s records, like that customer’s name, address, and account number.
The sample is designed to import data into both kinds of form documents. If you run the sample from the command line you can define the names of two output files, one for XFA and the other for AcroForm.
FDF, XFDF, and XML files are used as source documents for importing content into AcroForm documents, while XFD, XDP, or XML files are used to import content into XFA forms 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. XDP refers to XML Data Package, an XML-based companion to the PDF format created by Adobe in 2003. The XFD file format uses the Extensible Forms Description Language for laying out forms data used in business transactions.
This sample demonstrates exporting data from XFA and AcroForm documents to database files. This allows you to take data received in PDF forms, such as survey responses or completed applications from customers or clients, and capture that content in a database table or spreadsheet for storage and further processing.
The sample is designed to export data from both kinds of form documents. If you run the sample from the command line you can define the names of two output files, one for XFA and the other for AcroForm.
Data from AcroForm documents can be exported to FDF, XFDF, and XML files, while XFD, XDP, or XML files are used receive content exported from XFA forms documents. These file formats are described above under ImportFormsData.