Unlock the Power of Direct PDF Editing with WebViewer 10.7

Working With XFA: Options and Alternatives

By Ian Morris | 2024 Jun 27

Sanity Image
Read time

2 min

Summary: In this article, we explore XFA, its current use, and Apryse's solutions for working with XFA documents in 2024. Apryse offers the pdfXFA add-on for flattening dynamic XFA forms, the Apryse SDK DocGen for merging data into PDFs, and the Fluent platform for creating data-driven documents with minimal coding.

Introduction

Copied to clipboard

Even 30 years after the introduction of PDF, one of the most common use cases continues to be entering and capturing data using forms. Over the years, there have been two main ways to create PDF forms to capture data: AcroForms and XFA forms. Both came from Adobe, and both have their own advantages and disadvantages. However, XFA has been deprecated from the PDF specification, while AcroForms remain supported - which can lead to problems for those sectors that still use XFA.

In this article, we’ll explore what XFA is, where it is still used, and the various options and alternatives Apryse can offer for working with XFA documents.

What is XFA?

Copied to clipboard

The XML Forms Architecture (XFA) is a family of proprietary XML specifications originally developed by JetForm and submitted to the World Wide Web Consortium (W3C) in 1999. Following JetForm’s rebranding as Accelio in 2002, the company was acquired by Adobe. Consequently, XFA forms were introduced in the PDF 1.5 specification and Acrobat version 6.

Essentially, XFA wraps XML-based forms inside a PDF. Since they allow data to be entered into PDF, XFA forms serve a similar role to standard PDF-based fillable forms (also known as Acrobat forms or “AcroForms”); however, they differ in one significant way. Rather than just having a static layout, XFA forms can dynamically reflow PDF content, where entering information into a form field can influence the appearance of related form fields. For example, automatically resizing fields to fit the content or even omitting a page of a form if there is no data for it. So, the number of pages in an XFA form may change dynamically depending on the amount of data the user enters into form fields.

Like AcroForms, XFA forms can also contain JavaScript to perform certain actions, although the JavaScript syntax is not compatible with that used in AcroForms. In addition, programming it requires extensive knowledge of the XFA specification.

So, What’s the Problem?

Copied to clipboard

First and foremost, the International Organization for Standardization (ISO) published the PDF 2.0 specification in 2017, deprecating XFA. The specification states that features marked as deprecated should not be written into a PDF 2.0 document and should be ignored by a reader.

When XFA was first introduced in Acrobat version 6, XFA forms could only be designed using Adobe Forms Designer, which was later incorporated into Adobe’s LiveCycle platform as Adobe LiveCycle Designer. Over the years, LiveCycle and XFA have been dogged by criticism, both for LiveCycle’s prohibitive cost and XFA’s incompatibility with the older AcroForms technology.

In addition, XFA support in web browsers and mobile PDF readers (even Adobe’s own) was for a long time non-existent. While the situation has improved somewhat, to this day it causes many issues when attempting to fill out XFA-based forms in anything other than Acrobat on a desktop computer.

As an illustration, let’s attempt to view an XFA document using the PDF viewers in modern web browsers. First, let’s see how Chrome performs.

The PDF viewer built into Chrome (and Edge) results in an error message familiar to anyone experienced with attempting to open XFA files in unsupported viewers.

Blog image

Attempt 1: A familiar error message.

You can enable experimental XFA support in both Chrome and Edge, but comparing the results against how it looks in the full Acrobat desktop application on the left shows there is still a long way to go.

Blog image

Attempt 2: An improvement (of sorts).

Firefox has its own built-in PDF viewer, which, at first glance, appears to render the document correctly. However, comparing it against Acrobat shows things are still not working correctly.

Blog image

Attempt 3: Firefox does a better job, but again, there are many obvious issues.

The proprietary nature of XFA also means it cannot be used in documents complying with ISO-standardized PDF subsets, such as those for archiving (PDF/A) and accessibility (PDF/UA), among others. However, since many government departments (such as the US, UK, and Australia for example) continue to use XFA forms in their workflows, this incompatibility directly results in regulatory compliance concerns, such as with the American Disability Act (ADA) and Section 508 of the Rehabilitation Act, and long-term archival requirements.

Finally, Adobe themselves abandoned both the Dynamic XFA format and LiveCycle itself, announcing the end of Core technical support for LiveCycle in 2018. Instead, Adobe switched to offering Experience Manager Forms, which converts XFA into HTML5 based forms on the fly. This led to more criticism however, with users experiencing compatibility issues with conversions, and expressing reluctance to transitioning to a cloud-based solution.

I Need to Use XFA, What Now?

Copied to clipboard

So, what options are available if you absolutely, positively, need to work with the XFA format in 2024? For those locked into such workflows, Apryse has solutions offering differing capabilities depending on your needs.

From our iText stable of products we have the pdfXFA add-on for Text Core, which is a specialized tool designed to handle dynamic XFA forms. This add-on is particularly useful for workflows that require the flattening of dynamic forms for further processing or archiving, while also ensuring compliance with industry standards.

While the iText Core library can handle the reading and processing of XFA forms, pdfXFA extends iText’s capabilities by allowing you to convert interactive XFA forms into static PDF documents, which ensures the consistency of appearance and content. By doing this, you can preserve the visual, structural, and semantic information in documents, which you might need for archiving purposes.

You can also add a digital signature through pdfXFA, which provides additional security for documents in PDF workflows or archiving. In addition, it supports creating tagged PDFs, as well as PDF/A, and PDF/UA, which are important for compliance with long-term archiving and accessibility regulations.

Alternatively, on Windows OS you can use the Apryse PDFNet Virtual Printer and the Apryse SDK to flatten interactive XFA forms into static PDF documents. A recent tutorial explains how you can programmatically perform batch conversions of XFA forms into an intermediate XPS format which is then converted into standard PDFs.

XFA Alternatives Using Apryse SDK

Copied to clipboard

On the other hand, you might be investigating alternative options for XFA forms, whether replacing an existing XFA-based workflow or planning to implement something new involving interactive forms for data capture.

The obvious alternative to XFA forms is of course the venerable Acroforms; which are still widely used and can offer much greater JavaScript form field functionality than XFA. The only real advantage XFA has over Acroforms is the ability to dynamically reflow content, such as adding more rows to accommodate variable data. If you don’t need dynamic reflow, then traditional PDF fillable forms are a natural choice. You can find details on using Acroforms with the Apryse SDK here, along with code samples for creating, filling, and flattening form fields.

If you do need dynamic reflow capabilities, one solution could be to generate a web application to capture the required data using HTML forms, and then export it as JSON. You can then use Apryse SDK DocGen using Word templates and merge the data into PDFs for distribution. Again, we have a handy article on our DocGen solution which can serve as a great starting point for developing such a solution.

Fluent: Data-Driven Document Automation

Copied to clipboard

Yet another alternative to XFA is to use Fluent: Apryse’s document automation platform. Fluent is a powerful solution that can revolutionize generation of data-driven documents; simplifying the creation of reports and templates at scale with minimal coding required.

It provides an easy-to-use Microsoft Office plugin that enables end-users to independently generate reports and documents in Word, PowerPoint, and Excel, by inserting powerful tags into templates and apply conditional logic.

It also provides a centralized template administration component for template management, and flexible and secure document generation engines available in embedded Java and .NET versions, and the Fluent RESTful Engine which also supports Docker deployments.

Not to mention, Fluent is designed to meet your organization’s needs by easily integrating with any data source, including JSON, XML, SQL Server, MySQL, PostgreSQL, Oracle, MS Dynamics, OData, Salesforce, SharePoint, DB2, and more.

Fluent also offers flexible output options, with Microsoft Office document formats supported in addition to PDF, HTML, RTF and even images. Fluent also supports the PDF/A and PDF/UA standards for those who need to meet archiving or accessibility requirements.

For an overview of what Fluent offers, you can watch Solution Engineer Kelly Gillespie’s introduction to Fluent, or request a free trial to see it for yourself.

Sanity Image

Ian Morris

Technical Writer

Share this post

email
linkedIn
twitter