pikepdf
Python PDF manipulation library built on the QPDF C++ engine for repairing, merging, splitting, encrypting, decrypting, and compressing PDF files.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
No network layer; QPDF has a strong security track record; avoid processing untrusted PDFs as malformed inputs can exploit QPDF's C++ parser
⚡ Reliability
Best When
You need to structurally manipulate, repair, or transform PDF files at the object level without extracting text.
Avoid When
Your goal is to read text or table content from PDFs — pikepdf provides no text extraction API.
Use Cases
- • Repairing corrupted or malformed PDFs that other tools cannot open
- • Merging multiple PDF documents into a single file programmatically
- • Encrypting PDFs with user and owner passwords or removing existing encryption
- • Splitting a PDF into individual pages or page ranges
- • Reducing PDF file size by removing unused objects and recompressing streams
Not For
- • Extracting text content from PDFs (use PyMuPDF or pdfminer.six for that)
- • OCR on scanned document images (use docTR or Tesseract instead)
- • Rendering PDF pages to images (use PyMuPDF's page.get_pixmap() instead)
Interface
Authentication
Local Python library — no authentication required
Pricing
MPL 2.0 license (Mozilla Public License). Compatible with commercial and proprietary use. QPDF underlying library is also open source (Apache 2.0).
Agent Metadata
Known Gotchas
- ⚠ pikepdf does NOT provide text extraction — agents that accidentally use it expecting text output will get empty or object-level data
- ⚠ Incremental saving (save with incremental=True) is required for certain certified/signed PDFs to preserve digital signatures
- ⚠ Opening a PDF in a with block is required to release QPDF resources; forgetting this causes file handle leaks in long-running agents
- ⚠ Encrypted PDFs must be opened with the password parameter — there is no automatic detection of whether a password is needed before open() fails
- ⚠ Page objects removed from one PDF and added to another must use the make_indirect() method or the resulting PDF will be invalid
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for pikepdf.
Scores are editorial opinions as of 2026-03-06.