Apache PDFBox cannot find class 'Loader'. Why?

The Loader class has been added January 25, 2020. SVN log

It's not part of version 2.0.18, as it is not in this file: pdfbox-2.0.18-src.zip

So this class is simply too new and that's why you cannot use it!


Loader class is never introduced in version 2.x or lower. So, you can't use it.

Alternatively, you can use load() method from PDDocument class to load PDF files.

Modify to this :

try (FileOutputStream fos = new FileOutputStream(signedFile);
     PDDocument document = PDDocument.load(inputFile)) {

        // code 

}

Read this :- https://pdfbox.apache.org/2.0/migration.html


The PDDocument class will represent the PDF document that is being processed. Its load() method will load in the PDF file specified by the File object :

PDDocument document = PDDocument.load(new File("path/to/pdf"));

Tags:

Java

Pdfbox