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.

Travis CI build status (Linux and macOS) AppVeyor CI build status (Windows) PyPI

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:

Python 3.5, 3.6 and 3.7 are fully supported.

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.7 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 ~86% 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.

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 tests/resources/copyright file describes licensing terms for the test suite and the provenance of test resources.

Project details


Release history Release notifications | RSS feed

This version

1.5.0

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pikepdf-1.5.0-cp37-cp37m-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.7mWindows x86-64

pikepdf-1.5.0-cp37-cp37m-win32.whl (848.9 kB view details)

Uploaded CPython 3.7mWindows x86

pikepdf-1.5.0-cp36-cp36m-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.6mWindows x86-64

pikepdf-1.5.0-cp36-cp36m-win32.whl (849.0 kB view details)

Uploaded CPython 3.6mWindows x86

File details

Details for the file pikepdf-1.5.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pikepdf-1.5.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pikepdf-1.5.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 1fe86a0dc45160f60354da1ae7a38a42d518de4c0609f6afd64c3044a25d84dd
MD5 78ce94ce94d21e056e80fe10b70bda7d
BLAKE2b-256 80e7dcbe6886a0653f8d742dc054b96c4ac9f0ca7a688ae0f4e0c4b597e67c9e

See more details on using hashes here.

File details

Details for the file pikepdf-1.5.0-cp37-cp37m-win32.whl.

File metadata

  • Download URL: pikepdf-1.5.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 848.9 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pikepdf-1.5.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 0091f6408a81a20464f2b25699eb4cf294be7c38bd1d57b38b09e8f165ca1b79
MD5 ef9e643035104f2081b678c9f07a0df4
BLAKE2b-256 4d007a28a6f91d35e7483bf1480840c062b4276a819825a5b249f10a7acfa9f2

See more details on using hashes here.

File details

Details for the file pikepdf-1.5.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pikepdf-1.5.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for pikepdf-1.5.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 3b36184e2f2fa289760cefef137694ed43f25954dae3e807b85f9196d0c37add
MD5 2af09a4a2e00e23bd9206a63656b6bdf
BLAKE2b-256 6a93af15ca6ac6c30d5b5e911690c1b6c7299c6d095d16b22b8334330db32bb7

See more details on using hashes here.

File details

Details for the file pikepdf-1.5.0-cp36-cp36m-win32.whl.

File metadata

  • Download URL: pikepdf-1.5.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 849.0 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for pikepdf-1.5.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 082fcc6a9b9ee40d4f7b602388eaace90859de3f1c9f74bd95f19992ff97257d
MD5 d7d096c35af48d54aa35c1f9c339a492
BLAKE2b-256 9048edd209bf696571242cd92b36d119b8c04d2f7b3a248dee780c932f083372

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page