Skip to main content

PyMuPDF is a Python binding for the PDF rendering library MuPDF V 1.9a

Project description

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

You need to have MuPDF v1.9a generated first. This process depends on your platform, see below. MuPDF’s source comes with installation procedures for various operating systems, so you should be able to pick the right one for you. Linux versions also often provide pre-generated MuPDF software.

Once this is done, the rest should be as easy as running python setup.py install.

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 please make sure that the dependencies are satisfied: brew install mupdf-tools jpeg jbig2dec freetype openssl

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

We have prepared pre-generated binaries here, that are suitable for your Python version. Using this option avoids downloading anything else and requires no compiler nor Visual Studio. Please refer to this document for details.

You can also directly download your binary (less than 5 MB each) from one of the following GitHub links:

pymupdf-1.9.2.0-py27-x64.zip

pymupdf-1.9.2.0-py27-x86.zip

pymupdf-1.9.2.0-py31-x64.zip

pymupdf-1.9.2.0-py31-x86.zip

pymupdf-1.9.2.0-py32-x64.zip

pymupdf-1.9.2.0-py32-x86.zip

pymupdf-1.9.2.0-py33-x64.zip

pymupdf-1.9.2.0-py33-x86.zip

pymupdf-1.9.2.0-py34-x64.zip

pymupdf-1.9.2.0-py34-x86.zip

pymupdf-1.9.2.0-py35-x64.zip

pymupdf-1.9.2.0-py35-x86.zip

If you however 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. This is also the way, how the pre-generated binaries have been created.

Usage

You can render supported documents, extract text in a variety of formats, access meta information, table of contents and other links, and (PDF only) decrypt, compress / decompress files, re-arrange / duplicate / delete pages, join documents or update meta information and bookmarks.

The underlying graphics library also offers a range of very fast image handling functions that can be used independently from dealing with document files.

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

You can access the complete documentation as a PDF or as a Windows compiled html.

Legacy Support

Contact

Please direct comments or any issues to either the bug tracker of GitHub or e-mail the authors Ruikai Liu, Jorj X. McKie.

Project details


Release history Release notifications | RSS feed

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