-
Notifications
You must be signed in to change notification settings - Fork 617
Ubuntu Installation Experience
Jorj X. McKie edited this page Feb 10, 2018
·
14 revisions
MuPDF 1.12.0, PyMuPDF 1.12.2
This is a list of steps that should lead to a successfully installed PyMuPDF. It has been tested on Ubuntu 16.04, 16.10, and 17.10 with Python 3.6, but it should work with other version combinations, too.
- Get the MuPDF source from the site
wget https://mupdf.com/downloads/mupdf-1.12.0-source.tar.gz
(latest version as of writing. Others available here: https://mupdf.com/downloads/archive/). - MuPDF also has a repository on GitHub. This, however, is the latest development version! Do not use it: it may not be compatible with PyMuPDF.
- Once unpacked, modify the
Makerules
file by adding-fPIC
to theCFLAGS
so:CFLAGS += -Wall -fPIC
(this is near the top of the file so no need to search). - Run the initial make:
make HAVE_X11=no HAVE_GLFW=no HAVE_GLUT=no prefix=/usr/local
- If no issues occur install:
make HAVE_X11=no HAVE_GLFW=no HAVE_GLUT=no prefix=/usr/local install
- Get the corresponding version of
PyMuPDF
:git clone -b <correct branch> https://github.com/rk700/PyMuPDF.git
(<correct branch> should matchmutool
version). - Edit the
setup.py
to point to the correct directories as indicated by the prefix used when making.
Here is the resp. code snippet:
... include_dirs=['/usr/local/include/mupdf', # we need the path of the MuPDF and zlib$ '/usr/local/thirdparty/zlib', # '/usr/include/mupdf', ], library_dirs=['/usr/local/lib'], libraries=['mupdf', #'crypto', #openssl is required by mupdf on archlinux #'jbig2dec', 'openjp2', 'jpeg', 'freetype', 'mupdfthird', ], # the libraries to link with ...
(Comment unnecessary libraries out)
- Run
python setup.py build
If no exception is thrown install either with python setup.py install
or pip install
.
HOWTO Button annots with JavaScript
HOWTO work with PDF embedded files
HOWTO extract text from inside rectangles
HOWTO extract text in natural reading order
HOWTO create or extract graphics
HOWTO create your own PDF Drawing
Rectangle inclusion & intersection
Metadata & bookmark maintenance