What is qpdf?
qpdf is an open-source command-line tool and C++ library for working with the structure of PDF files. It performs content-preserving transformations and supports splitting and merging documents, encryption, linearization, and structural inspection. It can also create PDFs when the calling application supplies all the content. The project is licensed under the Apache License, Version 2.0 and is maintained by Jay Berkenbilt and Manfred Holger, who hold the copyright with earlier work dating from 2005.
It runs locally, with binary distributions available for Windows, macOS, and Linux, and can be built from source. Building needs a C++ compiler that supports C++20, while linking against the library needs a C++17-compatible compiler. The project says qpdf has very few external dependencies, and is intentionally lightweight. The command line follows the pattern qpdf, input file, options, output file. Password-protected files can be opened with --password, and --split-pages writes separate output files for each page or group of pages.
Its scope is deliberately low-level: it does not render PDFs, extract text, or provide higher-level interfaces for editing page contents. The documentation notes that many programs generate simple PDF files but cannot password-protect or web-optimize them, which is where qpdf is typically applied afterwards. Developers can embed its library in applications.
Key capabilities
- Structural transformation Rewrites PDF structure while preserving document content.
- Document assembly Splits and merges PDF files, or creates files from content supplied by the application.
- Linearization Produces linearized PDF output.
- Encryption Supports PDF encryption through configurable cryptographic providers, including compatibility with older algorithms.
- Inspection Exposes PDF structure for study and analysis.
- Library integration Provides a C++ API with support for static and dynamic linking.
Where qpdf fits
- Splitting and merging Copy objects and manipulate page lists to merge PDFs, or use --split-pages to write separate output files per page or group of pages.
- Linearization Rewrite a PDF so it is optimized for fast web view.
- Encryption Password-protect PDF files that the originating tool cannot protect, and open password-protected files with --password.
- Structural inspection Inspect files for study or analysis and learn how a PDF is built internally.
- Scripted command-line processing Read input, options and output in one qpdf invocation so transformations can run from scripts.
- Page selection Combine --pages with --empty to build a new document from selected pages of other files.
- PDF creation from scratch The library can create PDFs when the application supplies all the content.
- C++ library Embed the library in applications, linking with pkg-config or cmake.
Reviews of qpdf
Be the first to share your experience with qpdf.
Write a review
Loading review form…
