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".

.. code-block:: python

# Elegant, Pythonic API
pdf = pikepdf.open('input.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.

.. code-block:: bash

pip install pikepdf

For users who want to build from source, see `installation <https://pikepdf.readthedocs.io/en/latest/index.html>`_.

pikepdf is `documented <https://pikepdf.readthedocs.io/en/latest/index.html>`_
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.

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.

`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 your obligations.
MPL 2.0 is compatible with the GPL and LGPL - see the
`guidelines <https://www.mozilla.org/en-US/MPL/2.0/combining-mpl-and-gpl/>`_
for notes on use in GPL.

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

Uploaded Source

Built Distributions

pikepdf-0.3.3-cp37-cp37m-win_amd64.whl (859.4 kB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.7m macOS 10.6+ intel

pikepdf-0.3.3-cp36-cp36m-win_amd64.whl (859.3 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m macOS 10.6+ intel

pikepdf-0.3.3-cp35-cp35m-win_amd64.whl (859.3 kB view details)

Uploaded CPython 3.5m Windows x86-64

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

Uploaded CPython 3.5m

pikepdf-0.3.3-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.3.tar.gz.

File metadata

  • Download URL: pikepdf-0.3.3.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.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.3.tar.gz
Algorithm Hash digest
SHA256 6ccec26034149cc30d377918bb3be007a0798e6e46b2d98aed849279cab04fee
MD5 f70ff6f04a4de1a4cab25aedf9cdef15
BLAKE2b-256 848f224ff7bd1f73c19998bb716dfbd0542b5c0362c72d11182be4a29d469d0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 859.4 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.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for pikepdf-0.3.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8ff55322d305396633b1f61b35071314650d6dd7ce9e8039a2d499a31c363c4d
MD5 ab3a4952c41a2fe1cddf5bbc851f5fa6
BLAKE2b-256 e664895e14798e66827a06eb3f50d7d712514504b5152fd53ef6775971eecae9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-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.26.0 CPython/3.6.3

File hashes

Hashes for pikepdf-0.3.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ed080ee85334448ad97557c820ecfa66e395fd6d4979682b41b59a2b020700b9
MD5 225f47ce1d2fc6dbf3791084b567a12a
BLAKE2b-256 6f8c594bb9d08cd51f3fcbdd7b5a19e34ce0dfe54738b356391de14380de7ac9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-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.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.3-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 e7d53d3f992d039f80a7f8347702b18a2e48751251aa6363531fe8281fc0b7f5
MD5 cb5aa8288080d14fc697816ce98b6ef8
BLAKE2b-256 67e6f3deb86018246a53dc1c662f20431d0c6e5e5838cf24a9f96fc8febf0e9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 859.3 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.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6

File hashes

Hashes for pikepdf-0.3.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 254667039c1cf4dab4f9096ae680755acfc7ba8f8b230e8cbc71cc7800a1ea32
MD5 0700b456e4e912518e1d028813fc2edb
BLAKE2b-256 249f0ed6255803ee3da641dc91f673bd674d69347f1fbf12f7c75969b45e12e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-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.26.0 CPython/3.6.3

File hashes

Hashes for pikepdf-0.3.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 be66415e38429d742baa86d60a6fd9baff9d685ca40296406fa1210f0094c5ef
MD5 096ec64bf195d364c4150d06089b57e7
BLAKE2b-256 7d7a7a709fb230afe2a55ed5c47edbce4111a39b51227167a9a6fa25e20b1894

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-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.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.3-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 b0fc970c4d3cef9a827fe10b3d726fab3e4804910ea106c07180cc0968b65c95
MD5 23f0bd4e38dad5674388ee0eb5007134
BLAKE2b-256 cf6bce4bab225314a8d47ce6952769bbf2fc227a9816e65918d420fd8454f19a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 859.3 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.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.4

File hashes

Hashes for pikepdf-0.3.3-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 1ef665ff921caebd76c6c286bc8493e5f8482e415a10e9886212c13313daeb5a
MD5 9cbcf683083830c7ba4aaf19fcad25da
BLAKE2b-256 57e133d16063f06b78382fa14416133368a954a22a07fd0c64a5c8ce4a32f673

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-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.26.0 CPython/3.6.3

File hashes

Hashes for pikepdf-0.3.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 985bee4955a31cfef78ec138d476d1c0eb739ad655369a07628150b92c43cf51
MD5 11538550cfee7127f042bfdf832a8ab1
BLAKE2b-256 56d6af8465f83bf3b061bcfa6b767908ca827ddcc839ad045025e1f5d1e78e4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pikepdf-0.3.3-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.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0rc1

File hashes

Hashes for pikepdf-0.3.3-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 fee7f893b1e9ee57614dc278d656fce40ae3b048024b01da753829dfc06eefac
MD5 8961c8547a67a17603e523bc98ed333a
BLAKE2b-256 f1f2c4e05f83accdf79b17771e4ab91f134d0e34ad03f9d5e1853c2c008b07d2

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