Display complex PDF documents with MuPDF
PDF on Steroids
PDFs with many hundreds of pages and equal numbers of images can easily bring PDF viewers such as Okular or Evince to their knees. In contrast, MuPDF puts even the thickest digital tomes on your screen in the blink of an eye.
You might be familiar with this situation: You want to view a PDF document, but as soon as you load it or you try to view the first page on less than state-of-the-art hardware, your favorite PDF viewer slows to a crawl. Even a modicum of scrolling in the document totally overtaxes the system.
This typically happens with PDF documents containing a large number of pages and many charts and images. The PDF viewers typically delivered with a Linux distribution (e.g., Evince or Okular) soon reach their limits. In such cases, it's time to switch to MuPDF [1]. This lean and powerful document viewer displays not only PDF-formatted documents but also XPS, OpenXPS, and CBZ files.
The Contenders
MuPDF's appearance may be a little plain, but even rendering large PDF files is unlikely to faze the tool (Figure 1). MuPDF does not just scroll quickly through documents that are difficult to render, it also displays the content in a far crisper way than its competitors. The test object in our lab was the art e-book Radiant Identities by US photographer Jock Sturges [2]. On Debian and Fedora, I used the PDF viewers Okular, Evince, Xpdf, and QPDF in addition to MuPDF. The hardware in the lab was a well-equipped workstation and – for comparison's sake – an entry-level laptop by HP.
Most PDF viewers on Linux use the Poppler [3] library to render PDF documents. As a dynamic library, Poppler is designed to leverage the capabilities of state-of-the-art desktop systems. Its disadvantage is inadequate processing speed for large, graphically complex PDFs. That's one reason why you should give MuPDF a chance. And, most Linux distributions have the application in their package sources, so the installation can typically be handled conveniently using the distro's package manager.
State of the Art
In terms of speed, MuPDF definitely impresses, using its own renderer, called pdfdraw-mupdf
, and its own graphics library, dubbed Fitz. The focus in developing these libraries was primarily on speed and precision: Fitz computes anti-aliasing right down to the subpixel level, whereas other libraries stop at the pixel level. This ensures entirely crisp rendering and fast speed.
MuPDF can handle the current PDF 1.7 standard, and it supports searching, transparency, encryption, hyperlinks, and comments through built-in modules. As of version 1.2, MuPDF also supports form completion and JavaScript execution. The available MuPDF viewers for Linux, Mac OS X, and Windows and the apps for Android and iOS [4] are simply examples of what MuPDF is capable of. The modular design and the portability of the code make it possible to integrate MuPDF into other applications. For example, the Sumatra PDF program for Windows [5] and Zathura [6] for Linux are based on MuPDF.
Controls
MuPDF is launched at the command line by appending the PDF document to open, and the entire path, as in:
mupdf </path/to/example>.pdf
In Fedora, the basic command is mupdf-x11
. Various hot keys and keyboard shortcuts (see Table 1) let the user control the view, set bookmarks, and scroll through the document. The viewer does not have a graphical toolbar or a sidebar with thumbnails.
Table 1
Keyboard Shortcuts
Key | Function |
---|---|
+ or = |
Zoom in |
- |
Zoom out |
Page-Down or . |
Next page |
Page-Up or , |
Previous page |
> |
Forward 10 pages |
< |
Back 10 pages |
Shift+L |
Rotate page counterclockwise |
Shift+R |
Rotate page clockwise |
<number>g |
Go to specified page number |
m |
Add bookmark |
t |
Go to bookmark |
/ |
Search |
n, N |
Find next |
Shift+N |
Find previous |
w |
Shrink window to match document size |
Alt+Q |
Quit MuPDF |
The man page for MuPDF [7] lists a number of additional parameters, some of which you can append to the start command. For example, you can define the resolution at which MuPDF opens the document or modify the way fonts are displayed to suit your own requirements by adapting the anti-aliasing. That said, however, MuPDF is a viewer-only program and does not offer a print function.
Buy this article as PDF
(incl. VAT)