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.

Features:

- Editing, manipulation and transformation of existing PDFs
- Based on the mature, proven QPDF C++ library
- Reading and writing encrypted PDFs, with all encryption types except public key
- Supports all PDF compression filters
- Supports PDF 1.3 through 1.7
- Can create "fast web view" (linearized) PDFs
- Creates standards compliant PDFs that pass validation in other tools
- Automatically repairs damaged PDFs, just like QPDF
- Can manipulate PDF/A, PDF/X and other types without losing their metadata marker
- Implements more of the PDF specification than existing Python PDF tools
- For convenience, renders PDF pages or embedded PDF images in Jupyter notebooks and IPython

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

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.


Installation
-----------

Binary wheels are available for Linux, macOS, and Windows for x64 systems.
32-bit wheels will be added if anyone requests them.

- ``pip install pikepdf``

The binary wheels should work on most systems work on Linux distributions 2012
and newer, macOS 10.11 and newer (for Homebrew), Windows 7 and newer.

**From source (GCC or Clang)**

A C++11 compliant compiler is required, which includes most recent versions of
GCC (4.8 and up) and clang (3.3 and up). A C++14 compiler is recommended.

libqpdf 7.0.0 is required at compile time and runtime. Many platforms have not
updated to this version, so you may need to install this program without a
package manager.

- clone this repository
- install libjpeg, zlib and qpdf on your platform, including headers
- ``pip install .``

**On Windows (Requires Visual Studio 2015)**

pikepdf requires a C++11 compliant compiler (i.e. Visual Studio 2015 on
Windows). See our continuous integration build script in ``.appveyor.yml``
for detailed instructions.

Running a regular ``pip install`` command will detect the
version of the compiler used to build Python and attempt to build the
extension with it. We must force the use of Visual Studio 2015.

- clone this repository
- ``"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64``
- ``set DISTUTILS_USE_SDK=1``
- ``set MSSdk=1``
- download `qpdf binaries for MSVC <https://github.com/qpdf/qpdf/releases/download/release-qpdf-8.0.2/qpdf-8.0.2-bin-msvc64.zip>`_
- ``pip install .``

Note that this requires the user building ``pikepdf`` to have
registry edition rights on the machine, to be able to run the
``vcvarsall.bat`` script.

Windows runtime requirements
----------------------------

On Windows, the Visual C++ 2015 redistributable packages are a runtime
requirement for this project. It can be found
`here <https://www.microsoft.com/en-us/download/details.aspx?id=48145>`__.

Building the documentation
--------------------------

Documentation for the example project is generated using Sphinx. Sphinx
has the ability to automatically inspect the signatures and
documentation strings in the extension module to generate beautiful
documentation in a variety formats. The following command generates
HTML-based reference documentation; for other formats please refer to
the Sphinx manual:

- ``cd pikepdf/docs``
- ``make html``


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.


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.2.2.tar.gz (994.4 kB view details)

Uploaded Source

Built Distributions

pikepdf-0.2.2-cp37-cp37m-manylinux1_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.7m

pikepdf-0.2.2-cp37-cp37m-macosx_10_6_intel.whl (973.9 kB view details)

Uploaded CPython 3.7m macOS 10.6+ intel

pikepdf-0.2.2-cp36-cp36m-win_amd64.whl (811.4 kB view details)

Uploaded CPython 3.6m Windows x86-64

pikepdf-0.2.2-cp36-cp36m-manylinux1_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.6m

pikepdf-0.2.2-cp36-cp36m-macosx_10_6_intel.whl (973.8 kB view details)

Uploaded CPython 3.6m macOS 10.6+ intel

pikepdf-0.2.2-cp35-cp35m-win_amd64.whl (811.5 kB view details)

Uploaded CPython 3.5m Windows x86-64

pikepdf-0.2.2-cp35-cp35m-manylinux1_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.5m

pikepdf-0.2.2-cp35-cp35m-macosx_10_6_intel.whl (973.8 kB view details)

Uploaded CPython 3.5m macOS 10.6+ intel

File details

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

File metadata

  • Download URL: pikepdf-0.2.2.tar.gz
  • Upload date:
  • Size: 994.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pikepdf-0.2.2.tar.gz
Algorithm Hash digest
SHA256 88b01fa8f87db20b345c76e1fa63a5b82c5c4a5e0f3702bdb8a1328fbc25a728
MD5 e6256894ae81595d169096eda3212f58
BLAKE2b-256 5003f5af2251b8c206a7768a315c0487572a25e8225b6c9549d0b142862626c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pikepdf-0.2.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 63bfc6536dd0b0ebe3719376d79b442a56467e60eee9cac5392365cc6695e95b
MD5 de6f0e3842e5510c092e49a5ade4d2e3
BLAKE2b-256 eb2308df8ef8b953837491be104843f60e0bd1437af8fb8813982e61b5f538d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pikepdf-0.2.2-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 dc7ff2d98b7e1ff7db7ea3babeb279cf3a1454bc186e819a0d54fb4ccca80cce
MD5 9198a8c6eeddef7b5141aeb4c6c3aff2
BLAKE2b-256 7e9c7e3bb58c058c54950431674e5be37e1a06383ef0e250e0d51f27b1a62e69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pikepdf-0.2.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 1a1da0fd039016f8b4734c9ee666afb2a859b07d64372de6798fe89c7d24c06c
MD5 aad3bcc8e56270f81abd558992ac0ce8
BLAKE2b-256 6a8f51cc7fa4d7a129caa18cefbd6ac16fc2fa4b7548c9f32c80aaa097507adc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pikepdf-0.2.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b5783f504183b32b72d81cd95516f062219d28706db91afb9add24b11eec7c8b
MD5 243fabd23ff942b59637268e073c0d77
BLAKE2b-256 5a813e86aa61e3e4eaab1cc1a9ef6ea32343f7974900b3f71d43e1657385f3fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pikepdf-0.2.2-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 5223671fb04d9fc983976df812b30942f8ba82952f8a5cfe6bef8263a3101651
MD5 9777fab8fd61fcde8025810d1ff2c0e7
BLAKE2b-256 22463bb3f60a4ffc0ce921b74d366a2d0fc51c0f2ec6aa3bc387a63eac01446e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pikepdf-0.2.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 d710b984fae3d51af79da0c38d4bac551828e916a27a7bb6fdf1804d8351d161
MD5 8bee9d9231ea96b1eccccb770e83dc6f
BLAKE2b-256 1cdc8447187c1bae0310c156b2a5fd030bff06c61a76cd547fc2890625ae2dad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pikepdf-0.2.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 77b61bf57d76c1c97ee22571b93d7a6cee64cdda6ccdcd60d86a29ed9fa0f453
MD5 7b4192074d5ccde7b813a47e3e14bf86
BLAKE2b-256 309442ab527b65bf59dad2d83c44862f1f37472836e61add03b700ca69a9bf00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pikepdf-0.2.2-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 d3faa08d9e5e29be894d6f1f983d52504a888269565336b6ec3d6e8175858d47
MD5 bd1d8e34140a0244bf91c6053b7dcd68
BLAKE2b-256 11999af0d364d6b903723feeb649c15734fce0055f7d5209f0f419847be2ed99

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