Read and write PDFs with Python, powered by qpdf
Project description
pikepdf is a Python library allowing creation, manipulation and repair of PDF files. It is provides a wrapper around QPDF.
Python + QPDF = “py” + “qpdf” = “pyqpdf”, which looks like a dyslexia test. Say it out loud, and it sounds like “pikepdf”.
Python 3.5 and 3.6 are fully supported.
Features:
Editing, manipulation and transformation of existing PDFs
Based on the mature, proven QPDF C++ library
Can read and write PDFs with any type of PDF encryption (except public key)
Supports all PDF compression filters
Supports PDF object streams
Supports PDF 1.3 through 1.7
Can manipulate PDF/A and other types of PDF without losing their metadata marker
Can create “fast web view” (linearized) PDFs
Automatically recovers and repairs damaged PDFs
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
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, and requires some knowledge of the PDF specification.
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
On Unix (Linux, macOS)
Binary wheels are available for x86-64 Linux platforms and Intel macOS. 32-bit wheels will be added if anyone needs them.
pip install pikepdf
From source
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 ./pikepdf
On Windows (Requires Visual Studio 2015)
Windows is not currently part of continuous integration, so this might not work.
For Python 3.5:
clone this repository
pip install ./pikepdf
pikepdf requires a C++11 compliant compiler (i.e. Visual Studio 2015 on Windows). 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%....VCvcvarsall.bat” x64
set DISTUTILS_USE_SDK=1
set MSSdk=1
pip install ./python_example
Note that this requires the user building python_example 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.
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 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, 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
Built Distributions
File details
Details for the file pikepdf-0.1.4.tar.gz
.
File metadata
- Download URL: pikepdf-0.1.4.tar.gz
- Upload date:
- Size: 967.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c54016b168d9de6eccfb5ba7566c2eb5a537c870543bb86d5de106628664495 |
|
MD5 | d59e94042373776a31e3aeff1504b9f1 |
|
BLAKE2b-256 | 8e7fa40b471fd7f7890066b217dbf4d219e4f1a1721baf72049e090afe075c1e |
File details
Details for the file pikepdf-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: pikepdf-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35d7e396f9b2df2cea36b3ab25e604861c3c9ca325a0f333e7fe629fee997131 |
|
MD5 | a82c5971dbc29d5c34a9eaf2fefa76f8 |
|
BLAKE2b-256 | ec59ca1804c3604a6e5f2606b9f3fd533b1c7f94db3622f6d8f63136058c85eb |
File details
Details for the file pikepdf-0.1.4-cp36-cp36m-macosx_10_6_intel.whl
.
File metadata
- Download URL: pikepdf-0.1.4-cp36-cp36m-macosx_10_6_intel.whl
- Upload date:
- Size: 899.4 kB
- Tags: CPython 3.6m, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ab1a872a9705b7ef410535711dbe2849174e6eeaf4f5f913b958ec716dd0bae |
|
MD5 | 36381d0c759ffb7180f8605328cece93 |
|
BLAKE2b-256 | a4739320c07f6aa22ba9c5c21fa0d5e4e51bc407fb1d12ded74a42f684a69151 |
File details
Details for the file pikepdf-0.1.4-cp35-cp35m-manylinux1_x86_64.whl
.
File metadata
- Download URL: pikepdf-0.1.4-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae2815df2302e6cfce84ad6dfddf5f1db804b472bfa96b1ab467283f9355a0dd |
|
MD5 | 601c04ffa538776a787fc2a08c08fde5 |
|
BLAKE2b-256 | 07ae74401cdf360be26212bb5650a47a9ef9253efe0e1d0270cfc5d7541cf14f |
File details
Details for the file pikepdf-0.1.4-cp35-cp35m-macosx_10_6_intel.whl
.
File metadata
- Download URL: pikepdf-0.1.4-cp35-cp35m-macosx_10_6_intel.whl
- Upload date:
- Size: 899.4 kB
- Tags: CPython 3.5m, macOS 10.6+ intel
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c4ab4332c228921448d71222d1c6b487beab3679adca4c55d661215f843d7f1 |
|
MD5 | e26eda0036c46f5bc0c95447ade2d4e1 |
|
BLAKE2b-256 | 1f068c597d98c4704e03726c19fcda00d847b5116a56bf6efe98dd4831738085 |