Utilities
Transform PDF structure with qpdf
Rewrite PDF structure without rendering pages or changing their visible content.
overview
What qpdf does
Connect a PDF and qpdf writes a transformed copy to the node's FILE output. Enable --linearize to optimize byte ordering for incremental web viewing, or --decrypt to remove encryption from an authorized document.
--password supplies the password for an encrypted input. It is passed before the input file. The original PDF is never overwritten; every run writes a separate artifact.
qpdf changes PDF structure rather than page appearance. Use pdftotext for visible text, OCRmyPDF for searchable scans, and ImageMagick when the required operation is pixel-based.
source github.com/qpdf/qpdf
use cases
Where qpdf fits
Linearize a PDF
Optimize object ordering so a web server can begin serving pages before the whole file downloads.
Decrypt an authorized PDF
Supply the document password and write an unencrypted copy for downstream processing.
Normalize PDF structure
Rewrite a damaged or unusual PDF into a cleaner output artifact.
reference
qpdf inputs and flags
| Name | Type | Flag | Description |
|---|---|---|---|
| input | FILE | --input | Input PDF file. |
| linearize | BOOLEAN | --linearize | Optimize the PDF for web viewing. |
| decrypt | BOOLEAN | --decrypt | Write an unencrypted output PDF. |
| password | STRING | --password | Password for an encrypted input PDF. |
Showing key inputs. qpdf exposes 4 inputs in total.
example
Run qpdf
qpdf --linearize input.pdf output.pdfqpdf: operation succeeded with warnings; resulting file may have some problems# output.pdf is a linearized PDFguidance
Choosing qpdf
Use qpdf for structural PDF transforms such as linearization and decryption. Use pdftotext for text extraction and OCRmyPDF when scanned pages need a text layer.
pdftotext
Extracts visible text from PDF pages.
ocrmypdf
Adds a searchable text layer to scanned PDFs.
pdfcpu
Offers a broader set of PDF validation and manipulation operations.
faq
qpdf questions
related
More Utilities tools
browser-fetch
Headless Chromium render: requested URL, final URL, status, and title next to the page.
cewl
Spider a URL and return a wordlist for password crackers.
csvkit
SQL on one CSV. The table name is the file stem.
dnsgen
Wordlist and mined-word subdomain permutation.
duckdb
In-process SQL on CSV, JSON, and Parquet. No server.
edge-tts
Microsoft Edge neural speech from text or a script file. No API key.
Run qpdf yourself
A one-page PDF fixture feeds qpdf with --linearize and produces a separate web-optimized PDF.
Facts on this page come from the live Trickest tool library.