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)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.