A content-preserving PDF document transformer
open sourceApache-2.0self-hostablefree
qpdf is a command-line tool and C++ library for structural, content-preserving transformations on PDF files. It linearizes ('fast web view'), encrypts and decrypts, splits and merges pages, rewrites object and cross-reference streams, and can show a PDF's internal structure (including as JSON or in its editable QDF mode) for inspection. It does not render PDFs or extract text; it is a low-level tool for the structure of PDF files. It is Apache-2.0 licensed.
Ways to install
Package managers
Problems it solves
- make a big PDF start showing in the browser before the whole file downloads
- the PDF opens in Chrome but our parser says the xref table is broken
- strip the owner password and print restrictions from a PDF I'm allowed to edit
- encrypt a generated PDF with AES-256 and a user password from a script
- I need to see what objects, streams and dictionaries are actually inside this PDF
- uncompress a PDF's content streams so I can read and hand-edit them in a text editor
- dump the internal structure of a PDF as JSON to debug why it renders wrong
- take pages 1-3 from one file and 10-12 from another without re-rendering anything
- rewrite a PDF with object streams to make it smaller without touching the images
- check whether a PDF is structurally valid before we accept the upload
- a C++ library to copy pages between PDFs while keeping everything byte-for-byte intact
Features
- linearization (web-optimized PDFs)
- encryption and decryption
- splitting and merging pages, copying objects between PDFs
- object streams and cross-reference stream rewriting
- inspection of PDF structure for study or analysis
- C++ library for creating PDFs when you supply the content
- signed releases (cosign / GPG)
Capabilities
| Has a command line tool | plan not known |
|---|---|
| Has official SDKs | plan not known |
Alternatives
The same job
These do what qpdf does.
- pdftk (PDFtk Server and pdftk-java) A command-line tool for working with PDFs
- PyMuPDF A high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
- Apache PDFBox The Apache PDFBox library is an open source Java tool for working with PDF documents.
- Ghostscript An interpreter for the PostScript language and PDF files
- lopdf A Rust library for PDF document manipulation.
- MuPDF The ultimate library for managing PDF documents
