Read and write PDFs with Python, powered by qpdf
Project description
=======
**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
Built Distributions
File details
Details for the file pikepdf-0.3.0.tar.gz
.
File metadata
- Download URL: pikepdf-0.3.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c757a3d84b09494f0b402b890511107da3a9f4d845a53d142edfb69b1165ffe7 |
|
MD5 | 0d4e8c3617ba88783f73d64291d48cac |
|
BLAKE2b-256 | 39979dd6f1e2158f61100f2cb8828de2e6f35f9edb634af405ecc0146ba70567 |
File details
Details for the file pikepdf-0.3.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 859.0 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fd5d95f2d6b3a915cca0bbd1345f3b856eef002c4fa45c69e6fb2ef91e7bc5d |
|
MD5 | 0a1f97557c3deb384c92a64c6496a281 |
|
BLAKE2b-256 | eca4b8e532feb4f6e11a5b027e25677d9b7829a4bc4351dbaf8d039f608a238c |
File details
Details for the file pikepdf-0.3.0-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7661ccfb07aa115c1e76517a8c74cddc11fc006e12ec36ce572e7e945f97f80d |
|
MD5 | 2ba29aab37a781ac4b0ce620722db08b |
|
BLAKE2b-256 | 538dcb0adca6ba054b0bb00e135b6f260ab3d8d22ca2a2a378ae9a5319790dfb |
File details
Details for the file pikepdf-0.3.0-cp37-cp37m-macosx_10_6_intel.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp37-cp37m-macosx_10_6_intel.whl
- Upload date:
- Size: 986.3 kB
- Tags: CPython 3.7m, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3dff164728acc0f702f373b8e8972d4d3201df8c479ffb2b3ddf14fda3fd863 |
|
MD5 | 290d3d51fbffdd2ae37a81ddf10ad4f9 |
|
BLAKE2b-256 | b5e04da2abddf9e1e2f26d3296e6b6e3444a714c1d26f1dd85134a0c6afe564d |
File details
Details for the file pikepdf-0.3.0-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 858.9 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca2e8230b3bc4d293e0ed02cfc26495c90be412cff0c699d19005200c2a5916e |
|
MD5 | b41b18007eccd1a6842e98fdb020ce27 |
|
BLAKE2b-256 | 08e36f605e44f79132c67982be8755097f8ff5862c8c851d18260b90ca17f2fd |
File details
Details for the file pikepdf-0.3.0-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d089892882d4d29ca765daa3e0098855e0ad35691fa75ffd24c06dc9c8fc4c1 |
|
MD5 | 6d42988673156db5da2ccb8994c3ef01 |
|
BLAKE2b-256 | fbd53be087beb390a07fff5c933e37d6ff41822af6d2becb3a44447d07c45069 |
File details
Details for the file pikepdf-0.3.0-cp36-cp36m-macosx_10_6_intel.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp36-cp36m-macosx_10_6_intel.whl
- Upload date:
- Size: 986.2 kB
- Tags: CPython 3.6m, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 009fc4f346b948685226ac56001220c512cae79f9e4ed45549aef3f8b41a847a |
|
MD5 | db97dc124f98706ff69fbb3bb212f3d1 |
|
BLAKE2b-256 | cad569c6751c1a86c3fc5a3bb1c6cec2581b2f779f6c110a2c9f81682745a3b0 |
File details
Details for the file pikepdf-0.3.0-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 858.9 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 931db0ebff9b70b495ef9b86a402ad7a8ea6fb5f22a1829bc10d9829d28939ae |
|
MD5 | f8c66d37ceb53764d26719217c710336 |
|
BLAKE2b-256 | 6a58ad5e65d12edbcd287593a64d26feddc38d578d6b8c70573a49b3478d9c1f |
File details
Details for the file pikepdf-0.3.0-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89f6b71318116be758a8dc94bb5359a1c32516c2fceda9b5674dbf27ce5b954d |
|
MD5 | c1ecfed1d9f336e88a34da056fcb9176 |
|
BLAKE2b-256 | a3874abdf8a9dbf58284b3eaef72d8886f7076cc49cba49f3ce664f6afb6d134 |
File details
Details for the file pikepdf-0.3.0-cp35-cp35m-macosx_10_6_intel.whl
.
File metadata
- Download URL: pikepdf-0.3.0-cp35-cp35m-macosx_10_6_intel.whl
- Upload date:
- Size: 986.2 kB
- Tags: CPython 3.5m, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6a3b1348d831fed09a2f0a99972e470d1a2b0c8568517d74cdde6ee0e219bb0 |
|
MD5 | 6154d113f3db7ec6ea0d2504ec53e1af |
|
BLAKE2b-256 | 14f8f1725e25d2d351bbec026a6fd841bdfe35456a6fc21bf2c972f98f960d51 |