9.11.  Extract XFA Data to XML

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.37: “XFA Data”.

Program Start

::
:: Extract XFA data of a PDF document as XML
::

@echo off
setlocal
set CLASSPATH=./lib/aspectj-1.8.7/*;%CLASSPATH%
set CLASSPATH=./lib/bouncycastle-jdk15on-153/*;%CLASSPATH%
set CLASSPATH=./lib/commons-logging-1.2/*;%CLASSPATH%
set CLASSPATH=./lib/pdfbox-2.0.0/*;%CLASSPATH%
set CLASSPATH=./lib/pdfunit-2016.05/*;%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

Input

The input file for the script is xfa-enabled.pdf, a sample document from iText.

Output

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: