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| image:: https://img.shields.io/travis/pikepdf/pikepdf/master.svg?label=Linux%2fmacOS%20build
:target: https://travis-ci.org/pikepdf/pikepdf
:alt: Travis CI build status (Linux and macOS)

.. |windows| image:: https://img.shields.io/appveyor/ci/jbarlow83/pikepdf/master.svg?label=Windows%20build
:target: https://ci.appveyor.com/project/jbarlow83/pikepdf
:alt: AppVeyor CI build status (Windows)

.. |pypi| image:: https://img.shields.io/pypi/v/pikepdf.svg
:target: https://pypi.org/project/pikepdf/
:alt: PyPI


|travis| |windows| |pypi|

pikepdf is based on `QPDF <https://github.com/qpdf/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".

Python 3.5, 3.6 and 3.7 are fully supported.

**To install:**

.. code-block:: bash

pip install pikepdf

Key features:

- Editing, manipulation and transformation of existing PDFs
- Based on the mature, proven QPDF C++ library
- Works with encrypted PDFs
- Supports all PDF compression filters
- Can create "fast web view" (linearized) PDFs
- Creates standards compliant PDFs that pass validation in other tools
- Automatically repairs damaged PDFs, just like QPDF
- Implements more of the PDF specification than existing Python PDF tools
- IPython notebook and Jupyter integration

.. code-block:: python

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


pikepdf is `documented <https://pikepdf.readthedocs.io/en/latest/index.html>`_
and actively maintained. Commercial support is available.

Feature comparison
------------------

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.

Python 2.7 and earlier versions of Python 3 are not currently supported but
support is probably not difficult to achieve. Pull requests are welcome.

+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| **Feature** | **pikepdf** | **PyPDF2** | **pdfrw** |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Editing, manipulation and transformation of existing PDFs | ✔ | ✔ | ✔ |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Based on an existing, mature PDF library | QPDF | ✘ | ✘ |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Implementation speed | C++ | 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 |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Supports password protected (encrypted) PDFs | ✔ (except public key) | Only obsolete RC4 | ✘ |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Save and load PDF compressed object streams (PDF 1.5) | ✔ | ✘ | ✘ |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Creates linearized ("fast web view") PDFs | ✔ | ✘ | ✘ |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Actively maintained | |commits| | |pypdf2-commits| | |pdfrw-commits| |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| 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 | ✔ | ✘ | ✘ |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Documentation | ✔ | ✘ | ✔ |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+
| Integrates with Jupyter and IPython notebooks for rapid development | ✔ | ✘ | ✘ |
+---------------------------------------------------------------------+-----------------------+-------------------+-----------------+

License
-------

pikepdf is provided under the `Mozilla Public License 2.0 <https://www.mozilla.org/en-US/MPL/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.
We exclude Exhibit B, so pikepdf is compatible with secondary licenses.
At your option may additionally distribute pikepdf under a secondary license.

`Informally <https://www.mozilla.org/en-US/MPL/2.0/FAQ/>`_, 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 the license.

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


.. |commits| image:: https://img.shields.io/github/commit-activity/y/pikepdf/pikepdf.svg
:target: https://github.com/pikepdf/pikepdf/graphs/commit-activity

.. |pypdf2-commits| image:: https://img.shields.io/github/commit-activity/y/mstamy2/PyPDF2.svg
:target: https://github.com/mstamy2/PyPDF2/graphs/commit-activity

.. |pdfrw-commits| image:: https://img.shields.io/github/commit-activity/y/pmaupin/pdfrw.svg
:target: https://github.com/pmaupin/pdfrw/graphs/commit-activity


Project details


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.

Source Distribution

pikepdf-0.3.2.tar.gz (1.9 MB view details)

Uploaded Source

Built Distributions

pikepdf-0.3.2-cp37-cp37m-win_amd64.whl (855.2 kB view details)

Uploaded CPython 3.7m Windows x86-64

pikepdf-0.3.2-cp37-cp37m-manylinux1_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.7m

pikepdf-0.3.2-cp37-cp37m-macosx_10_6_intel.whl (1.0 MB view details)

Uploaded CPython 3.7m macOS 10.6+ intel

pikepdf-0.3.2-cp36-cp36m-win_amd64.whl (855.0 kB view details)

Uploaded CPython 3.6m Windows x86-64

pikepdf-0.3.2-cp36-cp36m-manylinux1_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.6m

pikepdf-0.3.2-cp36-cp36m-macosx_10_6_intel.whl (1.0 MB view details)

Uploaded CPython 3.6m macOS 10.6+ intel

pikepdf-0.3.2-cp35-cp35m-win_amd64.whl (855.0 kB view details)

Uploaded CPython 3.5m Windows x86-64

pikepdf-0.3.2-cp35-cp35m-manylinux1_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.5m

pikepdf-0.3.2-cp35-cp35m-macosx_10_6_intel.whl (1.0 MB view details)

Uploaded CPython 3.5m macOS 10.6+ intel

File details

Details for the file pikepdf-0.3.2.tar.gz.

File metadata

  • Download URL: pikepdf-0.3.2.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.2.tar.gz
Algorithm Hash digest
SHA256 574ab287d326ef80ed5fe042ac3493831f1feba6c6deff552ef4a101da4a5d3c
MD5 d5c1bf99f66717995b960651194a5032
BLAKE2b-256 30bd7afb368ea0872e64208e9940c729afde2c27eff7ffe1bbb28a64b1bb5340

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 855.2 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for pikepdf-0.3.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 00812f91d0de9b1e62d84b1b35193f3837444335a85cfa15776f41478139987b
MD5 a31a9308657ac4f715578404cd6d113c
BLAKE2b-256 255acc2a8a702dacf67a9c48c87fdafa06e720f8505cfd8a6d61ee5cdf12e984

See more details on using hashes here.

File details

Details for the file pikepdf-0.3.2-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pikepdf-0.3.2-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for pikepdf-0.3.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 34644dc32b6427716ccf39682098327fbdf44e72d7cdb9510afb1d5442f57b6c
MD5 2d1fa4a88fc8ef904eae22245fe578e9
BLAKE2b-256 b258bde53c59cbb2960d121750f091ce314405aef6bb86afbd6e218a6bdeec72

See more details on using hashes here.

File details

Details for the file pikepdf-0.3.2-cp37-cp37m-macosx_10_6_intel.whl.

File metadata

  • Download URL: pikepdf-0.3.2-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.7m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.2-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 f24c16ef59628a3494ecbecec0a709ab4d380eb3e1ab9fba1e12956a6cc0c067
MD5 c9d3f92ac4f745fa0def17981481b89c
BLAKE2b-256 90dafe27008140efe21ed692f29d9f7c1ecea32f27e9d3ac903607cb632816a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 855.0 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for pikepdf-0.3.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 2d7cd45c08002b8a2ef4841c2ac63d3d8da085e76cffc887efff07a98c91e6db
MD5 367f0a8c6a2e7298cdbc290c91366ecd
BLAKE2b-256 3f073b2ac60a22fae9e9fa5ee1c3a68ad4486b2c1ce88f9dc1ba6afd9459d7e3

See more details on using hashes here.

File details

Details for the file pikepdf-0.3.2-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pikepdf-0.3.2-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for pikepdf-0.3.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5636022e155291a979119835873f9398d50840f7ce3d851c8199f7f42e31bc87
MD5 b311a8fcc9bd88813c85e379ac671e11
BLAKE2b-256 479c7db19ef42b0473d8ef948610799b920a3d83cdb695e556dfb75f46dffa79

See more details on using hashes here.

File details

Details for the file pikepdf-0.3.2-cp36-cp36m-macosx_10_6_intel.whl.

File metadata

  • Download URL: pikepdf-0.3.2-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.6m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.2-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 1d9f18e386c54161d04d1d3fde260a8311488ac3c583026a07cda5075e60fc88
MD5 2be72ba9f4f66aea44f590cf7894e6ac
BLAKE2b-256 b317cf46fa78f106d48ca764fd05fe9d5ad9063013af137cdb1d713a100c1d64

See more details on using hashes here.

File details

Details for the file pikepdf-0.3.2-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: pikepdf-0.3.2-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 855.0 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.3

File hashes

Hashes for pikepdf-0.3.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 54c53a46f32ef6151af8c8de4a8bf29c9906528cce82196d956d2c40a48d460f
MD5 551cb92388d46943a78f00c397dff838
BLAKE2b-256 2429cd6d3063e9f67c5198f4951837bcf93bb46a72a2b7da5be30a96586b19a0

See more details on using hashes here.

File details

Details for the file pikepdf-0.3.2-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pikepdf-0.3.2-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for pikepdf-0.3.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 606637e57ca4db1787620f8aa816a4e6d672a9963ab9f89cd64678a6c53a9a6f
MD5 0ec35487790940a1912d6817694d9419
BLAKE2b-256 dd6f35333f07c015f83413e1df0e07b9b51d87b72b9c1a83fbc3e166d4b8b976

See more details on using hashes here.

File details

Details for the file pikepdf-0.3.2-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

  • Download URL: pikepdf-0.3.2-cp35-cp35m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.5m, macOS 10.6+ intel
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.2-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 9b0e5a13e6bcf06fd63a27cb5c9d7e07806c374146ec353ded29246a8da74667
MD5 e1d1a312e34d2f01cf3c574c9a8e2d56
BLAKE2b-256 9437d6e1d9e4a30685adb2147eb8ca60cdf9d66c2625a1458bb3e661794ec1a2

See more details on using hashes here.

Supported by

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