PDF libraries
PDF libraries do very different jobs, and few do all of them well. Before you pick one, decide what you need:
- Render pages to images: MuPDF, PDFium, Poppler and their wrappers (PyMuPDF, go-fitz, pdfium-render). Pure-language libraries rarely render.
- Extract text: renderers do it well; pdfminer.six, pdfplumber, PdfPig, PDFBox and pdf-reader are good dedicated extractors.
- Create new documents from code: layout libraries such as ReportLab, QuestPDF, Prawn, OpenPDF, TCPDF, printpdf, or HTML-to-PDF converters like dompdf and mPDF.
- Modify existing files (merge, split, rotate, encrypt, fill forms): qpdf/pikepdf, pypdf, PDFBox, pdfcpu, lopdf, HexaPDF, PDFsharp.
Check licenses: MuPDF (and PyMuPDF, go-fitz), iText, HexaPDF and PDFsharp 6.5+ are AGPL (or commercial); Poppler and mPDF are GPL; QuestPDF needs a paid license above $1M annual revenue.
| Language | Library | Read | Write | Notes |
|---|---|---|---|---|
| C/C++ | MuPDF | yes | yes | fast rendering and text extraction, AGPL or commercial |
| C/C++ | PDFium | yes | yes | Chrome’s PDF engine, BSD license, rendering and forms |
| C/C++ | Poppler | yes | limited | rendering and text, GPL, standard on Linux |
| C/C++ | QPDF | yes | yes | structural edits: merge, split, encrypt, linearize, repair |
| C/C++ | PoDoFo | yes | yes | create and edit, text extraction, signing, LGPL |
| C/C++ | libHaru | no | yes | small C library for generating PDFs |
| C# | PdfPig | yes | basic | text extraction with layout analysis, Apache 2.0 |
| C# | PDFsharp | yes | yes | create, merge, split, encrypt; AGPL or commercial since 6.5 (MIT up to 6.2) |
| C# | QuestPDF | no | yes | fluent layout API for reports and invoices, community license |
| C# | iText | yes | yes | everything incl. signatures and PDF/A, AGPL or commercial |
| Java | Apache PDFBox | yes | yes | text extraction, rendering, forms, signing, Apache 2.0 |
| Java | OpenPDF | yes | yes | creation, LGPL/MPL fork of iText 4 |
| Java | iText | yes | yes | everything incl. signatures and PDF/A, AGPL or commercial |
| Go | pdfcpu | yes | yes | merge, split, rotate, encrypt, forms, watermarks, pure Go |
| Go | ledongthuc/pdf | yes | no | simple text extraction, pure Go |
| Go | go-fitz | yes | no | MuPDF binding: render pages, extract text, AGPL |
| Python | pypdf | yes | yes | pure Python: merge, split, text, forms, encryption |
| Python | pdfplumber | yes | no | text with positions and table extraction |
| Python | PyMuPDF | yes | yes | MuPDF binding: fast text, rendering, editing, AGPL |
| Python | pikepdf | yes | yes | QPDF binding: low-level edits, repair, encryption |
| Python | ReportLab | no | yes | the standard PDF generator for Python |
| Python | pdfminer.six | yes | no | detailed text and layout extraction |
| Ruby | HexaPDF | yes | yes | create and modify, AGPL or commercial |
| Ruby | Prawn | no | yes | the standard PDF generator for Ruby |
| Ruby | pdf-reader | yes | no | text and metadata extraction |
| Ruby | CombinePDF | yes | yes | merge, split, stamp pages, pure Ruby |
| Rust | lopdf | yes | yes | object-level reading and editing |
| Rust | yes | experimental | typed object model for reading | |
| Rust | printpdf | basic | yes | create PDFs with text, graphics, images |
| Rust | pdfium-render | yes | yes | PDFium binding: render, text, forms, edit |
| PHP | TCPDF | no | yes | create PDFs with HTML, barcodes, signatures; maintenance mode |
| PHP | FPDF and FPDI | import | yes | small generator, FPDI imports pages of existing PDFs |
| PHP | Dompdf | no | yes | HTML and CSS to PDF |
| PHP | mPDF | import | yes | HTML to PDF with good Unicode support, GPL |
| PHP | PdfParser | yes | no | text and metadata extraction, pure PHP |
By language#
- PDF libraries for C/C++ Open-source C/C++ PDF libraries compared: MuPDF, PDFium, Poppler, QPDF, PoDoFo and libHaru, for rendering, text extraction, editing and creating PDFs.
- PDF libraries for C# Open-source .NET libraries for PDF files: PdfPig for text extraction, PDFsharp to create and edit, QuestPDF for reports and iText for everything. Comparison.
- PDF libraries for Java Open-source Java libraries for PDF files: Apache PDFBox, OpenPDF and iText. Extract text, render pages, merge, split, fill forms, encrypt and create PDFs.
- PDF libraries for Go Open-source Go libraries for PDF files: pdfcpu to merge, split, encrypt and fill forms, ledongthuc/pdf to extract text, go-fitz to render pages.
- PDF libraries for Python Python PDF libraries compared: pypdf, pdfplumber, PyMuPDF, pikepdf, ReportLab and pdfminer.six. Extract text and tables, render pages, merge, split.
- PDF libraries for Ruby Ruby PDF libraries compared: HexaPDF to create and edit, Prawn to generate documents, pdf-reader to extract text and CombinePDF to merge and split.
- PDF libraries for Rust Rust PDF libraries compared: lopdf for object-level editing, pdf for typed reading, printpdf for creating PDFs and pdfium-render for rendering.
- PDF libraries for PHP PHP PDF libraries compared: TCPDF, FPDF and FPDI, Dompdf, mPDF and PdfParser. Create PDFs from code or HTML, import pages of existing PDFs, merge, encrypt.