Skip to main content

Read and write PDFs with Python, powered by qpdf

Project description

pikepdf

pikepdf is a Python library for reading and writing PDF files.

Build Status PyPI PyPI - Python Version Language grade: Python Language grade: C/C++

pikepdf is based on QPDF, a powerful PDF manipulation and repair library.

Python + QPDF = "py" + "qpdf" = "pyqpdf", which looks like a dyslexia test. Say it out loud, and it sounds like "pikepdf".

# Elegant, Pythonic API
with pikepdf.open('input.pdf') as pdf:
    num_pages = len(pdf.pages)
    del pdf.pages[-1]
    pdf.save('output.pdf')

To install:

pip install pikepdf

For users who want to build from source, see installation.

pikepdf is documented and actively maintained. Commercial support is available.

Features

This library is similar to PyPDF2 and pdfrw - it provides low level access to PDF features and allows editing and content transformation of existing PDFs. Some knowledge of the PDF specification may be helpful. It does not have the capability to render a PDF to image.

Feature pikepdf PyPDF2 pdfrw
Editing, manipulation and transformation of existing PDFs
Based on an existing, mature PDF library QPDF
Implementation C++ and Python Python Python
PDF versions supported 1.1 to 1.7 1.3? 1.7
Python versions supported 3.5-3.8 2.6-3.6 2.6-3.6
Save and load password protected (encrypted) PDFs ✔ (except public key) ✘ (Only obsolete RC4) ✘ (not at all)
Save and load PDF compressed object streams (PDF 1.5)
Creates linearized ("fast web view") PDFs
Actively maintained pikepdf commit activity PyPDF2 commit activity pdfrw commit activity
Test suite coverage ~89% very low unknown
Creates PDFs that pass PDF validation tests ?
Modifies PDF/A without breaking PDF/A compliance ?
Automatically repairs PDFs with internal errors
PDF XMP metadata editing read-only
Documentation
Integrates with Jupyter and IPython notebooks for rapid development

In Production

  • OCRmyPDF uses pikepdf to graft OCR text layers onto existing PDFs, to examine the contents of input PDFs, and to optimize PDFs.

  • pdfarranger is a small Python application that provides a graphical user interface to rotate, crop and rearrange PDFs.

License

pikepdf is provided under the Mozilla Public License 2.0 license (MPL) that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.

Informally, MPL 2.0 is a not a "viral" license. It may be combined with other work, including commercial software. However, you must disclose your modifications to pikepdf in source code form. In other works, fork this repository on GitHub or elsewhere and commit your contributions there, and you've satisfied your obligations. MPL 2.0 is compatible with the GPL and LGPL - see the guidelines for notes on use in GPL.

The debian/copyright file describes licensing terms for the test suite and the provenance of test resources.

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pikepdf, version 1.19.3
Filename, size File type Python version Upload date Hashes
Filename, size pikepdf-1.19.3-cp35-cp35m-macosx_10_9_x86_64.whl (998.1 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp35-cp35m-manylinux2010_i686.whl (10.1 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp35-cp35m-manylinux2010_x86_64.whl (10.3 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp35-cp35m-win32.whl (1.3 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp35-cp35m-win_amd64.whl (1.4 MB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp36-cp36m-macosx_10_9_x86_64.whl (995.0 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp36-cp36m-manylinux2010_i686.whl (10.1 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp36-cp36m-manylinux2010_x86_64.whl (10.3 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp36-cp36m-win32.whl (1.3 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp36-cp36m-win_amd64.whl (1.4 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp37-cp37m-macosx_10_9_x86_64.whl (995.1 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp37-cp37m-manylinux2010_i686.whl (10.1 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp37-cp37m-manylinux2010_x86_64.whl (10.3 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp37-cp37m-win32.whl (1.3 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp37-cp37m-win_amd64.whl (1.4 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp38-cp38-macosx_10_9_x86_64.whl (1.0 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp38-cp38-manylinux2010_i686.whl (9.9 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp38-cp38-manylinux2010_x86_64.whl (10.1 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp38-cp38-win32.whl (1.2 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pikepdf-1.19.3-cp38-cp38-win_amd64.whl (1.4 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pikepdf-1.19.3.tar.gz (2.4 MB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page