Using the utility
ExtractXFAData you can export XFA data from
a PDF document and use it in XPath based tests as described in section
3.30: “XFA Data”.
:: :: Extract XFA data of a PDF document as XML :: @echo off setlocal set CLASSPATH=./lib/pdfunit-2015.10/*;%CLASSPATH% set CLASSPATH=./lib/itext-5.5.1/*;%CLASSPATH% set CLASSPATH=./lib/bouncycastle-jdk15on-150/*;%CLASSPATH% set TOOL=com.pdfunit.tools.ExtractXFAData set OUT_DIR=./tmp set IN_FILE=xfa-enabled.pdf set PASSWD= java %TOOL% %IN_FILE% %OUT_DIR% %PASSWD% endlocal
The input file for the script is
sample document from iText.
The output XML file
_xfadata_xfa-enabled.out.xml is quite long.
To get a better impression of the generated code, some of the XML-Tags in
the next picture are folded:
Internally the extraction program uses the method
from the iText (http://www.itextpdf.com) project.