How to Work With AcroForms & XFA
Two Form Standards, One Processing Pipeline
Most real-world PDF forms workflows involve a mix of AcroForms and XFA forms, often without a clean inventory of which form is which. Forms come in from multiple sources, were created at different times by different tools, and end up in the same processing pipeline. Knowing how to handle both form types correctly is a prerequisite for building a reliable forms automation system.
Working With AcroForms
AcroForms are the native PDF interactive form format and are supported by virtually every PDF SDK. Working with AcroForms programmatically is straightforward: load the document, access the form field dictionary, read or write field values, and save.
Key AcroForm operations include reading field names and types, setting field values (text, checkbox states, dropdown selections), generating field appearance streams for consistent rendering, flattening to static PDF, and importing or exporting field data via FDF or XFDF.
AcroForms are fully supported in Forms Extension alongside XFA. All data import, export, and flattening operations work identically for AcroForms and XFA forms within the same API.
Working With XFA Forms
XFA forms require a different approach. Because XFA stores form structure in XML rather than native PDF content, processing XFA forms requires an SDK with a built-in XFA rendering engine. Standard PDF field access APIs do not work on XFA form data.
Static XFA
Static XFA forms have PDF marking operators for the base page appearance and XFA grammar for field logic. They are more widely supported than dynamic XFA because the base visual rendering uses standard PDF content streams. For many operations, including flattening and data import, static XFA behaves similarly to AcroForms.
Dynamic XFA
Dynamic XFA forms use XFA exclusively for layout and rendering. There is no PDF base content. Every page, field position, and layout element is calculated by the XFA engine at open time. Processing dynamic XFA correctly requires a full XFA rendering engine, not just XML parsing.
Detecting Form Type Before Processing
Because different form types require different handling, the first step in any robust forms pipeline is form type detection. Forms Extension includes a form type detection API that identifies whether a document contains an AcroForm, static XFA, or dynamic XFA. Routing documents to the correct processing path based on their actual type prevents incorrect output and silent failures.
When to Convert Between Form Types
There are two scenarios where converting between form types is the right choice. The first is compatibility: if a dynamic XFA form needs to be used in a non-Acrobat environment, converting to AcroForm makes it accessible in Chrome, mobile viewers, and standard PDF tools. The second is compliance: if an XFA form needs to enter a PDF/A archiving workflow, it must either be flattened or converted to AcroForm, since XFA is not permitted in PDF/A.
Forms Extension supports XFA-to-AcroForm conversion for both static and dynamic XFA. The converted output is a standards-compliant interactive AcroForm.
Frequently Asked Questions
What is the difference between AcroForms and XFA in PDF?
AcroForms are the native PDF interactive form standard, defined in the PDF specification and supported by all modern PDF viewers. XFA is an Adobe-proprietary XML-based form format that was deprecated in PDF 2.0 and requires a specific rendering engine. AcroForms are forward-compatible; XFA is a legacy format.
How do I work with XFA forms programmatically?
Use Forms Extension for Adobe PDF Library. It provides API-level access to XFA rendering, flattening, conversion, and data import/export for both static and dynamic XFA forms, without requiring Acrobat.
What SDK processes both AcroForms and XFA?
Forms Extension for Adobe PDF Library handles AcroForms, static XFA, and dynamic XFA within a single API. It supports rendering, flattening, XFA-to-AcroForm conversion, and FDF/XFDF/XML data import and export for all three form types.
Get a Forms Extension free trial and start developing your forms workflows today.