skillfed

pikepdf

Read, write, repair, and transform PDFs in Python, powered by qpdf

pikepdf v10.11.0 10.3M downloads/30d#1,463 on PyPI2,789
Copyleft license MPL-2.0 Active released

What it is and what it does

pikepdf is a Python wrapper around qpdf, a mature C++ PDF library, that lets you read, modify, and repair PDF documents programmatically. It handles page operations (merge, split, rotate, rearrange), metadata editing (XMP and DocumentInfo), encryption/decryption (AES-256, AES-128, RC4), lossless image extraction, and direct access to PDF objects. The library automatically repairs structural damage when opening malformed PDFs, making it useful for sanitizing or normalizing documents.

It runs on modern Python (3.10+) and comes pre-built for Linux, macOS, and Windows on both x86-64 and ARM64 architectures, including free-threaded CPython 3.14. Three runtime dependencies (Pillow, lxml, packaging) keep the footprint manageable. pikepdf is not designed for PDF generation from HTML/templates, rendering to images, or text extraction—other libraries are better suited for those tasks.

Use it for:

  • Merge multiple PDFs into a single document or split and rearrange pages across files
  • Repair damaged or malformed PDFs automatically on open, then save corrected versions
  • Edit PDF metadata (title, author, creation date) and XMP properties programmatically
  • Extract images from PDFs losslessly without re-encoding JPEG or other compressed formats
  • Open password-protected PDFs and re-save with different encryption or no encryption
  • Optimize PDFs for web delivery using linearization (fast web view)

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

pikepdf reads, writes, repairs, and transforms PDF documents through a Python interface backed by the qpdf C++ library, handling page manipulation, metadata editing, encryption, and low-level PDF object access.

Yes. pikepdf is production-ready (stable since 2017, actively maintained, no known vulnerabilities), has broad platform support via pre-built wheels, and solves real PDF manipulation problems that pure-Python libraries struggle with. The MPL-2.0 license is permissive for most use cases. Install it if you need to repair, merge, encrypt, or manipulate existing PDFs; skip it if you only need text extraction or PDF rendering.

Install

pikepdf on PyPI

pip

pip install pikepdf

uv

uv add pikepdf

poetry

poetry add pikepdf

Installing pikepdf

Before you install

Medium install friction due to compiled C++ dependencies, but binary wheels are pre-built for common platforms (Linux, macOS, Windows on x86-64 and ARM64) requiring no compiler. Active maintenance with a release 14 days ago and 2789 repository stars.

License in practice

Licensed under MPL-2.0 (copyleft), which requires source code disclosure of modifications to pikepdf itself but permits both open and closed source projects to use it. Compatible with most commercial and open source projects.

Quickstart

pip install pikepdf

import pikepdf

with pikepdf.Pdf.open('input.pdf') as pdf:
    num_pages = len(pdf.pages)
    del pdf.pages[-1]
    pdf.save('output.pdf')

Requires Python 3.10 or later; binary wheels available for most platforms, but source builds require a C++ compiler.

Verify before relying

  • Whether qpdf's automatic repair handles all common PDF corruption patterns in practice
  • Performance characteristics for very large PDFs or batch operations

Package facts

License MPL-2.0 (copyleft)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 3 — Pillow, lxml, packaging
Maintenance actively maintained — 14 days since the last release
Last repo commit
First released
Downloads 10,269,759/month — #1,463 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pikepdf-10.11.0-cp310-cp310-macosx_14_0_arm64.whl; pikepdf-10.11.0-cp310-cp310-macosx_15_0_x86_64.whl; pikepdf-10.11.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; pikepdf-10.11.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pikepdf-10.11.0-cp310-cp310-musllinux_1_2_aarch64.whl; pikepdf-10.11.0-cp310-cp310-musllinux_1_2_x86_64.whl; pikepdf-10.11.0-cp310-cp310-win_amd64.whl; pikepdf-10.11.0-cp311-cp311-macosx_14_0_arm64.whl; pikepdf-10.11.0-cp311-cp311-macosx_15_0_x86_64.whl; pikepdf-10.11.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; pikepdf-10.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pikepdf-10.11.0-cp311-cp311-musllinux_1_2_aarch64.whl; pikepdf-10.11.0-cp311-cp311-musllinux_1_2_x86_64.whl; pikepdf-10.11.0-cp311-cp311-win_amd64.whl; pikepdf-10.11.0-cp312-cp312-macosx_14_0_arm64.whl; pikepdf-10.11.0-cp312-cp312-macosx_15_0_x86_64.whl; pikepdf-10.11.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; pikepdf-10.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pikepdf-10.11.0-cp312-cp312-musllinux_1_2_aarch64.whl; pikepdf-10.11.0-cp312-cp312-musllinux_1_2_x86_64.whl

Keywords: PDF

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Information TechnologyProgramming Language :: C++Programming Language :: Python :: 3Programming Language :: Python :: Free Threading :: 3 - StableProgramming Language :: Python :: Implementation :: CPythonTopic :: Multimedia :: GraphicsTopic :: Software Development :: Libraries

Tags

pdf manipulation pythonpdf merge split rotate pagespdf repair damaged filespdf encryption decryptionextract images from pdfpdf metadata editingpdf linearization optimization
pdf-manipulationdocument-processingencryption

More Libraries packages