Updated Sep 21, 2026

Utilities

Transform PDF structure with qpdf

Rewrite PDF structure without rendering pages or changing their visible content.

Agent

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

4 inputs
NameTypeFlagDescription
inputFILE--inputInput PDF file.
linearizeBOOLEAN--linearizeOptimize the PDF for web viewing.
decryptBOOLEAN--decryptWrite an unencrypted output PDF.
passwordSTRING--passwordPassword for an encrypted input PDF.

Showing key inputs. qpdf exposes 4 inputs in total.

example

Run qpdf

qpdf · command
qpdf --linearize input.pdf output.pdf
sample output
qpdf: operation succeeded with warnings; resulting file may have some problems# output.pdf is a linearized PDF

guidance

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

It reorders PDF objects for incremental loading over HTTP; it does not reduce image quality.

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.