Why can't I compile the iText source code?

Do I need to install Ghostscript?

31st May 2016

I get an error after running mvn install -P all -e to compile and install iText. I've also done mvn clean on before hand. The error says:

testFlatteningGenerateAppearances2(com.itextpdf.text.pdf.FlatteningTest): Path to GhostScript is not specified. Please use -DgsExec

Do I need to install Ghostscript?

Posted on StackOverflow on Sep 17, 2014 by user3769040

Add the parameter maven.test.skip=true or skipTests=true in the command line. The tests create plenty of PDF files (new documents) that need to be compared with reference PDF files (existing documents stored with the tests). Ghostscript is used to create images of those PDF files. These images are compared on a pixel basis to check if the new files have the same appearance of the reference files.

If you want to build iText with the tests, you need Ghostscript. If you want to build iText merely to get a jar, you can skip the tests and you don't need Ghostscript.

Click this link if you want to see how to answer this question in iText 5.


Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now