qpdf
$ qpdf Community Low RiskQPDF inspects, validates (--check), splits (--pages), linearizes (--linearize), encrypts, and decrypts (--decrypt) PDF files without altering page content streams. With native --json v2 export and --json-input reconstruction, it is uniquely machine-readable among PDF tools.
brew install qpdf Structural PDF validation, --json object inspection, and lossless page splitting execute locally at native speed with zero MCP overhead.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Standout --json (with --json-key filtering), --json-input, predictable exit codes (0 ok, 2 error, 3 warnings), and strictly non-interactive execution.
- Native
--jsonand--json-keyflags emit clean machine-readable PDF structure - Never prompts interactively on TTY
Preserves content streams losslessly and requires explicit --replace-input to overwrite source files, though --decrypt can strip restrictions if authorized.
- Requires explicit
--replace-inputfor in-place mutation - Supports
--checkread-only structural validation
Fast C++ binary distributed via Homebrew, all major Linux package managers, and Windows releases.
- Available via
brew install qpdfand official GitHub releases
Handles inspection, merging, splitting, linearization, encryption, and JSON round-tripping in one deterministic binary.
- Supports
--pages,--linearize,--decrypt, and--json
Actively maintained Apache-2.0 project (qpdf/qpdf) with decades of production PDF engineering.
- Official
qpdf/qpdfGitHub repository under Apache-2.0
Thorough ReadTheDocs manual and structured --help output covering every option and exit code.
- Detailed CLI reference at qpdf.readthedocs.io
Security, Auth & Guardrails
None required; optional --password= or --password-file= reads local PDF decryption passwords.
Free Apache-2.0 open-source C++ binary.
# QPDF Agent Rules - Run `qpdf --check` or `qpdf --json` before transforming unfamiliar PDFs. - Always write to a distinct output path instead of `--replace-input` unless overwrite is explicitly requested. - Pass `--warning-exit-0` only when you intentionally accept non-fatal PDF warnings.
Agent-Ready Command Recipes
Safe Read-Only Queries
qpdf --json input.pdf
Emits the complete PDF object graph, page count, and encryption status in structured JSON.
qpdf --check input.pdf
Verifies xref tables, stream lengths, and linearization without modifying the file.
Controlled Writes & Previews
qpdf --linearize input.pdf --pages . 1-5 -- subset.pdf
Writes pages 1–5 to a new web-optimized subset.pdf without touching input.pdf.
Strengths for Agents
- + Native
--jsonand--json-keyinspection eliminates fragile text scraping of PDF structure. - + Distinct exit code
3for warnings vs2for errors lets scripts handle repaired PDFs cleanly.
Caveats & Pitfalls
- ! Exit code
3(warnings) causes naiveset -eshell wrappers to abort unless--warning-exit-0is passed. - ! Only transforms PDF structure and objects; does not rasterize pages or extract plain text.