PDF libraries for Java
Java has 3 mature open-source PDF libraries:
- Apache PDFBox reads, renders and modifies PDFs: text extraction, page rendering to images, merging and splitting, forms, encryption and digital signatures. Its page-creation API is low-level (you position every line). Apache 2.0.
- OpenPDF is a fork of iText 4 under LGPL/MPL. It’s best at creating documents with paragraphs, tables and images, and it can also stamp, merge, fill forms and encrypt existing files.
- iText is the most complete: layout engine, text extraction, forms, digital signatures, PDF/A and PDF/UA, HTML to PDF. AGPL or commercial.
Pick PDFBox to read, extract text, render or modify files; OpenPDF to generate documents under a business-friendly license; iText when you need advanced signatures or conformance and can accept the AGPL or a license fee. For HTML-to-PDF without AGPL, OpenHTMLToPDF uses PDFBox.
- iText iText is a complete Java PDF library under AGPL or a commercial license. How to add it with Maven, create a PDF, extract text, merge and split PDFs.
- OpenPDF OpenPDF is an LGPL/MPL Java library to create and modify PDF files, a fork of iText 4. How to create a PDF with text and tables, merge PDFs, extract text.
- PDFBox Apache PDFBox is a Java library to read, render, create and modify PDF files. How to extract text, render pages to images, merge and split PDFs, rotate pages.