Python bindings for MuPDF's rendering library.
C Python
Latest commit e5eccf2 Nov 24, 2016 @JorjMcKie JorjMcKie committed on GitHub add v1.10 handling of links

README.rst

PyMuPDF 1.9.2

Release date: August, 2016

Authors

  • Ruikai Liu
  • Jorj X. McKie

Introduction

This is version 1.9.2 of PyMuPDF (formerly python-fitz), a Python binding which supports MuPDF 1.9a - "a lightweight PDF and XPS viewer".

MuPDF can access files in PDF, XPS, OpenXPS and EPUB (e-book) formats, and it is known for its top performance and high rendering quality.

With PyMuPDF you therefore can also access files with extensions *.pdf, *.xps, *.oxps or *.epub from your Python scripts.

See the Wiki for more info/news/release notes/etc.

Installation

Like v1.9.1, this version 1.9.2 is also based on MuPDF version 1.9a. Therefore, generating MuPDF again is not required to make use of it.

If you had not previously installed MuPDF, you must first do this. This process highly depends on your system. For most platforms, MuPDF source contains prepared procedures on how to do this. Linux distributions usually also provide their own ways on how to install MuPDF. See below for more details.

Once MuPDF is in place, installing PyMuPDF comes down to running the usual python setup.py install.

Also refer to this document for details.

Arch Linux

AUR: https://aur.archlinux.org/packages/python2-pymupdf/

Ubuntu

Since MuPDF v1.9a is not available yet in the official repo, you need to first build it from source. Make sure to add -fPIC to CFLAGS when compiling.

When MuPDF is ready, edit setup.py in PyMuPDF and comment out the line of library_dirs=[] to specify the directory which contains libmupdf.a and other 3rd party libraries. Remove crypto from libraries in setup.py if it complains.

OSX

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.a is for x86_64 only.

Finally, please double check setup.py before building. Update include_dirs and library_dirs if necessary.

Windows

You can download pre-generated binaries from here that are suitable for your Python version, and thereby avoid any compilation hassle. Please refer to this document for details.

If you want to make your own binary, have a look at this Wiki page. It explains how to use Visual Studio for generating MuPDF in some detail.

Usage

Please have a look at the basic demos or the examples which contain complete, working programs.

You can access the complete documentation (which contains a detailed tutorial) as a PDF, as a Windows compiled html or at PyPI.

Next Versions - Update

Version v1.9.3 exists as a branch. If you want to try out its new features, have a look at this. An overview can be found in this Wiki page.

MuPDF v1.10 has been officially published (2016-11-21). We are working to support it with PyMuPDF v1.10.0. This will be an extension of the v1.9.3 feature set which we do not plan to publish as an official PyMuPDF release any longer. You can, however, use branch 1.9.3 - it does work!

MuPDF's new version contains significant changes. Some of them (pixmaps, links) will impact PyMuPDF's API, so please check out Wiki pages dealing with any such changes.

Legacy Support

License

PyMuPDF is distributed under GNU GPL V3.

Contact

You can also find PyMuPDF on the Python Package Index PyPI.

We invite you to join our efforts by contributing to the the wiki pages.

Please submit comments or any issues either to this site or by sending an e-mail to the authors Ruikai Liu, Jorj X. McKie.