Packaging of pymupdf for Debian
Release date: July 31, 2020
On PyPI since August 2016:
This is version 1.17.4 of PyMuPDF, a Python binding with support for MuPDF 1.17.* - "a lightweight PDF, XPS, and E-book viewer".
MuPDF can access files in PDF, XPS, OpenXPS, CBZ, EPUB and FB2 (e-books) formats, and it is known for its top performance and high rendering quality.
With PyMuPDF you can access files with extensions like ".pdf", ".xps", ".oxps", ".cbz", ".fb2" or ".epub". In addition, about 10 popular image formats can also be opened and handled like documents.
For all supported document types (i.e. including images) you can * decrypt the document * access meta information, links and bookmarks * render pages in raster formats (PNG and some others), or the vector format SVG * search for text * extract text and images * convert to other formats: PDF, (X)HTML, XML, JSON, text
To some degree, PyMuPDF can therefore be used as an image converter: it can read a range of input formats and can produce Portable Network Graphics (PNG), Portable Anymaps (PNM, etc.), Portable Arbitrary Maps (PAM), Adobe Postscript and Adobe Photoshop documents, making the use of other graphics packages obselete in these cases. But interfacing with e.g. PIL/Pillow for image input and output is easy as well.
PDF documents can be created, joined or split up. Pages can be inserted, deleted, re-arranged or modified in many ways (including annotations and form fields).
PyMuPDF can also be used as a module in the command line using
"python -m fitz ...". This is a versatile utility, which we will further develop going forward. It currently supports PDF document
Our documentation, written using Sphinx, is available in various formats from the following sources. It currently is a combination of a reference guide and a user manual. For a quick start look at the tutorial and the recipes chapters.
For the major Windows and (thanks to our user @jbarlow83!) Mac OSX or Linux versions we offer wheels in the download section of PyPI. This includes Python 2.7 and version Python 3.5 through 3.8.
For other Python versions or operating systems you need to generate PyMuPDF yourself as follows. This should work for all platforms which support Python and MuPDF. In any case you need the development version of Python.
To do this, you must download and generate MuPDF. This process depends very much on your system. For most platforms, the MuPDF source contains prepared procedures for achieving this. Please observe the following general steps:
Be sure to download the official MuPDF source release from here.
Do not use MuPDF's GitHub repo. It contains their current development source, which is not compatible with this PyMuPDF version.
fitzfolder contains one or more files whose names start with a single underscore
"_". These files contain configuration data and hotfixes. Each one must be copy-renamed to its correct target location inside the MuPDF source that you have downloaded, before you generate MuPDF. Currently, these files are:
mupdf/include/mupdf/fitz/config.h. It contains configuration data like e.g. which fonts to support.
Since PyMuPDF v1.14.17, the sources provided in this repository no longer contain the interface files
fitz.wrap.c- they are instead generated "on the fly" by
setup.pyusing the interface generator SWIG. So you need SWIG being installed on your system. Please refer to issue #312 for some background.
If you do not use SWIG, please download the sources from PyPI - they continue to contain those generated files, so installation should work like any other Python extension generation on your system.
Once this is done, adjust directories in
python setup.py install.
The following sections contain further comments for some platforms.
Our users (thanks to @gileadslostson and @jbarlow83!) have documented their MuPDF installation experiences from sources in this Wiki page.
First, install the MuPDF headers and libraries, which are provided by mupdf-tools:
brew install mupdf-tools.
Then you might need to
export ARCHFLAGS='-arch x86_64', since
libmupdf.ais for x86_64 only.
Finally, please double check
setup.pybefore building. Update
If you are looking to make your own binary, consult this Wiki page. It explains how to use Visual Studio for generating MuPDF in quite some detail.
Earlier versions are available in the releases directory.
PyMuPDF is distributed under GNU GPL V3. Because you will implicitely also be using MuPDF, its license GNU AFFERO GPL V3 applies as well. Copies of both are included in this repository.
Please submit questions, comments or issues here, or directly contact the authors via their e-mail addresses.