A Java PDF library is a third-party JAR that parses, renders, or generates PDF files from Java code. The JDK has no native PDF support: javax.print can send bytes to a printer, but nothing in the standard library can read a PDF’s object graph, decode its content streams, or draw a page. Every PDF task in Java goes through a library.
Which one you need depends on the task. Creating documents, editing raw objects, and rendering pages are three different problems, and no single library is the best answer to all three. Budget, license terms, and support expectations narrow it further.
Java PDF libraries compared
| Library | License | Primary use |
|---|---|---|
| Apache FOP | Apache 2.0 | Generating PDF from XSL-FO |
| Apache PDFBox | Apache 2.0 | Reading, extraction, rendering, basic creation |
| Datalogics | Commercial | Adobe PDF Library access from Java |
| iText | AGPL v3 or commercial | Creation and low-level object editing |
| JPedal | Commercial | Rendering, extraction, viewing, printing |
What do you want to do with the PDF file?
All of the libraries below expose a Java PDF API. Find the task, then the tool.
- Create PDF documents. iText or Apache FOP.
- Debug a broken PDF. You need an inspector to view the PDF objects and the document tree. There are several approaches to debugging PDF files, including opening the raw structure in a text editor.
- Edit raw PDF objects. iText.
- Extract, print, or rasterize. Apache PDFBox or JPedal. See our guides to extracting text from PDF files in Java, printing PDF files from Java, and converting PDF to image in Java.
- Merge or parse existing files. See merging PDFs in Java and writing a Java PDF parser.
- Use the Adobe libraries from Java. Datalogics.
What can you do with JPedal?
JPedal is our commercial Java PDF library. It requires Java 17 or later and provides a Java PDF API allowing you to:
- Access and edit form and annotation data
- Add a PDF viewer to Java applications
- Convert PDF documents to images (including HEIC)
- Extract images, text, and metadata
- Inspect a PDF file
- Print PDF files
- Search text
You can also use our extensive PDF Library guide to help you choose the right library for you. Alternatively, if you choose build your solution in-house, our build vs buy guide can help you figure out development timelines and implication for your specific workflows.
FAQ
Does the JDK include a PDF library?
No. javax.print and java.awt.print can send a rendered image to a printer, and javax.imageio handles raster formats, but nothing in the standard library parses PDF syntax or decodes content streams. You need a third-party JAR for any PDF work.
Can I use iText in a closed-source commercial product for free?
No. The free distribution of iText is AGPL v3, which requires you to release the source of any application that uses it, including applications only reached over a network. Shipping closed-source software means buying a commercial license. Apache PDFBox and Apache FOP are Apache 2.0 and carry no such requirement.
Why do two libraries produce different output from the same PDF?
PDF is a description of drawing operations, not a fixed rendering. Differences in font substitution when an embedded font is missing, color space and ICC profile handling, blend mode support, and shading pattern interpolation all produce visibly different pages from identical input. This is why rendering fidelity is worth testing against your own corpus rather than trusting a feature matrix.