javapdfmergepdfboxnoclassdeffounderror

Apache PDFMergerUtility NoClassDefFoundError on Creation


I'm attempting to use the Apache PDFMergerUtility, following one of the many online examples. My problem is I get an NoClassDefFoundError exception while creating an instance: PDFMergerUtility pdfMerger = new PDFMergerUtility();

Here's my import: import org.apache.pdfbox.multipdf.PDFMergerUtility;

I downloaded the jar file pdfbox-2.0.15.jar and put in my Netbeans Project libraries.

What might be the cause?

I've read the Apache documentation, and looked at numerous examples that show the exact code.


Solution

  • You also need fontbox and commons-log, as described on the dependency page. Alternatively, you can use pdfbox-app, which has all needed for merging.