Why the fields come back blank
A PDF form can carry two separate field layers. The AcroForm layer is the standard one, and it is what most PDF libraries write to. The XFA layer (XML Forms Architecture) is an XML description that Adobe LiveCycle Designer adds on top. When a form has a dynamic XFA layer, Adobe Acrobat and Reader render from that XML and ignore the AcroForm values your code set, so a form you filled programmatically opens empty. You most often hit this with insurance ACORD forms and many government PDFs that were originally built in LiveCycle.
Confirm it is an XFA form
Open the file in a browser or a non-Adobe viewer. A dynamic XFA form usually shows a gray placeholder that reads 'Please wait...' instead of the fields, because only Adobe renders the XFA. Programmatically, check for an /XFA entry in the document's AcroForm dictionary. If there is no XFA entry and the fields are blank only in Adobe, you have a different problem, the NeedAppearances flag, not XFA.
How to fix it
You have two reliable options. First, strip the XFA layer after you fill the AcroForm fields, so every viewer falls back to the values you set; pdftk can do this with its drop_xfa output option. Second, for forms you fill at volume, stop depending on the original field tree: rebuild the document as a standard fillable PDF or a mapped template, then fill that copy. Rebuilding is the more durable path for recurring insurance or government forms, because it survives the agency reissuing the file.
Document-focused tools handle this step for you. Anvil's PDF filling API lets you map fields onto the page once and returns a flattened PDF, so your output never depends on a fragile XFA layer.
Back to All Questions