javaxmlpdfitextxfa

Compiling example program supplied by itext


http://itextsupport.com/download/xfaworker.html

I have downloaded iText example program and try to test it on my computer. Want to test that i can flattern the XFA form I have created using PDFBox library provided by Apache. I want to flatten my PDF so they can be joined into one pdf file. Below is list of all the files i thought was required for compiling. Most was obtained by following instructions from above url.

10/02/2015  05:15 PM    <DIR>          ..
23/02/2014  03:34 AM            10,114 antlr4-annotations-4.2.jar
23/02/2014  03:34 AM           327,041 antlr4-runtime-4.2.jar
23/04/2013  11:17 PM             2,199 FillAndFlatten.java
10/02/2015  05:15 PM               358 flatten.bat
16/05/2014  06:05 AM            24,193 itext-licensekey-1.0.3.jar
16/12/2014  08:53 AM            62,418 itext-pdfa-5.5.4.jar
16/12/2014  08:53 AM            97,001 itext-xtra-5.5.4.jar
09/02/2015  03:04 PM             2,226 itextkey.xml
16/12/2014  08:53 AM         2,148,390 itextpdf-5.5.4.jar
06/06/2014  10:41 PM             1,606 LICENSE-abego.TXT
29/05/2014  01:12 AM             1,537 LICENSE-ANTLR.txt
21/09/2014  12:35 AM            17,099 LICENSE-rhino.txt
23/02/2014  03:34 AM            25,515 org.abego.treelayout.core-1.0.1.jar
01/01/2013  03:20 AM               725 README.txt
20/09/2014  11:12 PM         1,134,765 rhino-1.7R4.jar
17/12/2014  01:29 AM         2,230,720 xfaworker-5.5.4.jar
25/05/2012  08:22 PM            27,624 xfa_data.xml
25/05/2012  08:22 PM            80,248 xfa_form.pdf

When i run the flatten.bat file this is output i get

C:\Users\jason.STERLINGSYSTEMS\Downloads\flatterner>C:\jdk1.8.0_25x64\bin\javac
-cp "itextpdf-5.5.4.jar;xmlworker-5.5.4.jar;xfaworker-5.5.4.jar;itext-licensekey
-1.0.3.jar" FillAndFlatten.java
FillAndFlatten.java:46: error: cannot access CssAppliers
        XFAFlattener xfaf = new XFAFlattener(document, writer);
                            ^
  class file for com.itextpdf.tool.xml.html.CssAppliers not found
FillAndFlatten.java:47: error: cannot access CssAppliersAware
        xfaf.flatten(new PdfReader(baos.toByteArray()));
            ^
  class file for com.itextpdf.tool.xml.html.CssAppliersAware not found
2 errors

C:\Users\jason.STERLINGSYSTEMS\Downloads\flatterner>java -cp ".;itextpdf-5.5.4.j
ar;xmlworker-5.5.4.jar;xfaworker-5.5.4.jar;itext-licensekey-1.0.3.jar;antlr4-run
time-4.2.jar;antlr4-annotations-4.2.jar;org.abego.treelayout.core-1.0.1.jar;rhin
o-1.7R4.jar" FillAndFlatten
Error: Could not find or load main class FillAndFlatten

So the question is why am i getting 2 errors? To me it looks like i am missing some libraries. Given i have followed their instructions not too sure what i am missing?


Solution

  • You have to add the xmlworker.jar to your directory flatterner. This file contains the class com.itextpdf.tool.xml.html.CssAppliersAware.