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.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distributions

pikepdf-0.3.1-cp37-cp37m-win_amd64.whl (854.8 kB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.7m macOS 10.6+ intel

pikepdf-0.3.1-cp36-cp36m-win_amd64.whl (854.8 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m macOS 10.6+ intel

pikepdf-0.3.1-cp35-cp35m-win_amd64.whl (854.8 kB view details)

Uploaded CPython 3.5m Windows x86-64

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

Uploaded CPython 3.5m

pikepdf-0.3.1-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.1.tar.gz.

File metadata

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

File hashes

Hashes for pikepdf-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7cdf0a874de395c8cf00c92605a7c55445bbf41df9f0aae7c4d1625b66c4be26
MD5 9cec9f2b2fe0e3c45c8285b899b59a59
BLAKE2b-256 cde81de3832c09826b50babefe0d833e452bb2caee61800b047d1094f9fde5ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 854.8 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.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for pikepdf-0.3.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5269f89c3e5296b7b7ec056ce3cbf28d014550d74f7b32681a9032aecf030149
MD5 582c6b7b7ae33c7169e2d29808fcc9dd
BLAKE2b-256 88cfba115c59678bba309b59f17ce15c8881955c999821c643ec9a8843e2c426

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-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.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3696c25b876603fe67b9b643738d660d9e21511f853173b1b9fbcfe09604625d
MD5 8200ea9aad32eb4f2419f8225a6dcf53
BLAKE2b-256 78396c3105b4fcd66493efce9d56a7d37d712ad25d620284c84c44ac24e30f8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-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.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.1-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 2149a2eee370dc1bf9885eede8dccb22ce6220380526c13dbcf0df2267dfe481
MD5 e28e49bcc4960f5ad48ed7d732bf9208
BLAKE2b-256 291b0dbcdd3c4eadcdad8405b4ae309402b2cfeec10b75ec28169cffd12628b9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 854.8 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.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for pikepdf-0.3.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 531abbb05415776ecd08b5e32e233bde3f44121c6a259d79b8609cccd37159ce
MD5 81ec0d61be4d249ca0707e0be57e453f
BLAKE2b-256 6a6b8d5a86e0e01644980c7fe9e243550d7f254220ba7c0d1bbba2da2d4a5aaf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-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.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 505be9f170a769dab79718858b82c0e9dd9a09c3519fabb25f7a37308db78b62
MD5 9cb431dda67e79d08ed1d4f29b91e002
BLAKE2b-256 d1f6ae41f9b4819362fb763408a540d73afc033341c2ec13e22d850e14d0973c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-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.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.1-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 cf6d392751920509a90d34bcb3d5418a6939633ebcc7b080dbb706d5b349b449
MD5 339dc537f9c25f690e6a73c51b40bfc5
BLAKE2b-256 6216c5025886b88a3cbe3b379b1e1625845b0c0e704d93662f04092c99858723

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 854.8 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.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.3

File hashes

Hashes for pikepdf-0.3.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 7947d6ce6f498b2b4655ff9e0dd8802d4eeae5b6dc10413447b2a9abf48d9030
MD5 593aae6ca84c10f9f7ce4d3069b87f8f
BLAKE2b-256 5b3bbdb7a5647227403221e8081064688e8ac5d1eef7b4770a8c0c77ebe62b9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-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.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 70a86406c42e0cb07369ec8afc40a0d64c22ef74b63d3c38397f334bd3235d6e
MD5 aaaf78d06fa9ea69dc647a1d9542fb2f
BLAKE2b-256 72b817c6d625e8af9e920b391eed4470ffab21b19e8a2db0e2e0bfe8bc01154a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.1-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.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 71476aea1382e28c2091769a6ba0ce21780ce49016ea6197dfcf4958d0421cd6
MD5 ee671df10401347a6d03802683159c84
BLAKE2b-256 6d70fa645ad6c70396f86d784c6a598e0558b8547a938038c79ddd719348bee4

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