Work in progress! This is guide will be improved over time. If you believe there is a missing topic, open an issue or help us with a contribution to improve the guide.
This guide describes the updates in Apache PDFBox 3.0 release. Use the information provided to upgrade your PDFBox 2.x applications to PDFBox 3.0. It provides information about the new, deprecated and unsupported features in this release.
PDFBox 3.0 requires at least Java 8. Testing has been done up to Java 11.
All libraries on which PDFBox depends are updated to their latest stable versions:
For test support the libraries are updated to
This section explains the fundamental differences between PDFBox 3.0 and 2.x releases.
All deprecated APIs and components from PDFBox 2.x have been removed in PDFBox 3.0. Deprecated APIs in
PDPageContentStream
have been kept but you are encouraged to replace them with the non deprecated calls
as they are treated to be of internal use only.
For loading a PDF PDDocument.load
has been replaced with the Loader
methods. The same is true for loading a FDF document.
When saving a PDF this will now be done in compressed mode per default. To override that use PDDocument.save
with CompressParameters.NO_COMPRESSION
.
PDFBox now loads a PDF Document incrementally reducing the initial memory footprint. This will also reduce the memory needed to consume a PDF if only certain parts of the PDF are accessed. Note that, due to the nature of PDF, uses such as iterationg over all pages, accessing annotations, signing a PDF etc. might still load all parts of the PDF overtime leading to a similar memory consumption as with PDFBox 2.0.
When accessing AcroForms
using PDDocumentCatalog.getAcroForm()
a number of fix ups are applied aligning PDFBox with most of the default behaviour
of Adobe Reader. If you'd like to bypass this use PDDocumentCatalog.getAcroForm(null)
.
The fix ups include
You can lookup the details in the org.apache.pdfbox.pdmodel.fixup
package of the source distribution and also create your own fix up(s).
The command line interface for the PDFBox App has been rewritten. As a result
-h
or --help
to display usage information-V
or --version
to display the version information