41

I like MuPDF's speed, but I am exasperated by the lack of documentation and its (unnecessarily) hyper-minimal interface with not a menu bar or context menu in sight. Does there exist a list of keyboard shortcuts for this application?

I only know of the following shortcuts:

  • fit to width: Shift + w
  • fit to height: Shift + h

What are the keyboard shortcuts available and where could I found them?

0

5 Answers 5

37

Copy-pasted from man mupdf:

A description of each of the supported options is included below.

-p password
        Uses  the  given  password  to  open an encrypted PDF file.  The
        password is tried both as user and owner password.

-r resolution
        Changes the initial zoom level, specified as the  resolution  in
        dpi.  The default value is 72.

MOUSE AND KEY BINDINGS

In  addition to the key bindings described below, the mouse can also be
used. Clicking the left mouse button follows links within the PDF while
dragging  with  the  left mouse button pans the page. Dragging with the
right mouse button selects an area and copies the enclosed text to  the
clipboard  buffer.  Using the scroll-wheel while pressing Control zooms
in/out, if Shift is pressed on the other hand then the page is panned.

L, R   Rotate page left (clockwise) or right (counter-clockwise).

h, j, k, l
        Scroll page left, down, up, or right.

+, -   Zoom in or out.

w      Shrinkwrap window to fit the page.

r      Reload file.

. pgdn right space
        Go to the next page

, pgup left b
        Go to the previous page

<, >   Skip back/forth 10 pages at a time.

m      Mark page for snap back.

t      Pop back to the latest mark.

[0-9]m Save the current page number in the numbered register.

[0-9]t Go to the page saved in the numbered register.

123g   Go to page 123.

/      Search for text.

n, N   Find the next/previous search result.

c      Toggle between color and grayscale rendering.
4
  • 4
    Thank you; this man command seems to be more useful than I thought. :-)
    – Dune
    Commented Jul 1, 2013 at 21:57
  • 1
    @Dune man and apropos.
    – dearN
    Commented Apr 12, 2015 at 17:50
  • 1
    @Dune the man command should always be your first stop for any CLI utility. In most cases you'll find what you need.
    – Elder Geek
    Commented Apr 12, 2015 at 17:50
  • Note for future readers that many of those changed since 2013 and askubuntu.com/a/919464/289412 below has the more updated version (and links to the documentation)
    – dee-see
    Commented Aug 23, 2020 at 10:27
22

Taken from the source code, this is an exaustive list of all mupdf shortcuts (with any possibile useful info).

←,→
h,j,k,l     navigate
            (even if the page is horizontal only j and k will change page;
            j and k will align the bottom (or the top) of the page with
            the bottom (or the top) of the window before changing page)

→,SPACE     next page
←,b
BACKSPACE   previous page
            (all these won't change the placement of the page
            in the window)

. ,         next/previous page
            (these will align the top (or bottom) of the page with
            the top (or bottom) of the window)

>,<         skip forth/back 10 pages
            (>< will align the top of the page with the top of the window)

[n]g
[n]ENTER    go to page n
            (will go to the first page with no number)

G           go to last page

[0-9]m,t    set and go to mark

+,=         zoom in
-           zoom out
            (note that zooming is restricted to certain 'levels' only -
            18, 24, 36, 54, 72, 96, 120, 144, 180, 216 and 288 dpi)

L,R         rotate 90° (counter)clockwise

W,H         fit to width, heigth
Z           autofit (fit to height if the page is vertical,
                     to width if the page is horizontal)

w           resize window to fit the page

f           fullscreen

/,?         search forward/backward
n,N         next/previous search term
            (n and N are swapped if the search is backward)

I           invert colors
C           toggle gray/redscale
c           choose grayscale or redscale

p           presentation mode
            (there will be a fade when changing pages)

r           reload the page

q           quit

Some infos:

dpi steps in zoom are hard-coded.

As in Vim, shortcuts like W (upper) will be activated both by pressing SHIFT+w and pressing w with CAPS LOCK on. Similarly, w (lower) will be activated both by pressing w (with CL off) and SHIFT+w (with CL on). This because keystrokes are internally treated as characters, which makes an upper W produced with SHIFT indistinguishable by one entered with CL.

mupdf doesn't watch if a file changes. Also zooming, fitting and moving without changing page won't reload the document, while all other movements (and r) will (or better - will reload the single page). However mupdf watches for SIGHUP, which means that it can be forced to reload the current page with killall -s SIGHUP mupdf or similar, which turns out to be very useful in an environment as Vim&Latex.

Finally,

S           save
a,s         rotate 15° (counter)clockwise

seem respectevely to activate a misterious save function and to be available only in a misterious debug mode. I don't know what they are for.

4
  • 2
    I was looking for the SIGHUP method to autorefresh muPDF. Thanks! I am sure it will help other people too. Commented Mar 9, 2017 at 0:33
  • 1
    On my mupdf 1.18 inverting colors is I not i. I can't edit it though, because edits have to be at least 6 characters.
    – shs
    Commented Nov 27, 2020 at 18:29
  • Thanks, I've updated the answer
    – pp.ch.te
    Commented Dec 30, 2020 at 10:47
  • Is there a way to show pages in continuous layout? e.g., next page doesn't just jump into view, but slides into and out of the view to show next/previous page.
    – Ejaz
    Commented Sep 29, 2022 at 18:40
7

The official documentation lists the key bindings for MuPDF OpenGL Viewer (a.k.a. mupdf-gl; but in some systems, it is executed via mupdf too), which supplanted the older x11- and win32-based viewers. Pressing F1 in the viewer works too.

Key bindings in version 1.11, according to the manual, are:

F1          Display help.
i           Display document metadata.
o           Toggle display of outline.
L           Toggle display of links.
r           Reload document.
q           Quit viewer.

f           Toggle fullscreen.
w           Shrinkwrap window to fit page.
W           Fit page width to window.
H           Fit page height to window.
Z           Fit page size to window.
[number] z  Set zoom resolution in DPI.
+           Zoom in.
-           Zoom out.
[           Rotate counter-clockwise.
]           Rotate clockwise.
[arrows]
  or        Pan page in small increments.
h, j, k, l

b           Smart move one screenful backward.
[space]     Smart move one screenful forward.
[comma]
  or        Go one page backward.
[page up]
[period]
  or        Go one page forward.
[page down]
<           Go 10 pages backward.
>           Go 10 pages forward.
[number] g  Go to page number.
G           Go to last page.

m           Save current page to navigation history.
t           Go back in navigation history.
T           Go forward in navigation history.
[number] m  Save current page in numbered bookmark.
[number] t  Go to numbered bookmark.

/           Start searching forward.
?           Start searching backward.
n           Continue searching forward.
N           Continue searching backward.

Several commands can take a number argument entered before the key, to modify the command. For example, to zoom to 150 dpi, type 150z.

To hide the gray box displayed by i or F1, use Esc. This is undocumented, but intuitive.

2
  • Palec, you offer the list of keyboard shortcuts for the mupdf-gl, which is a different program with a different set of capabilities (in particular, it supports bookmarks/document outline, unlike mupdf)
    – Maxim
    Commented Dec 9, 2021 at 1:04
  • Thanks for the heads up, @Maxim. I was not aware of the difference. Fixing my answer to make that explicit.
    – Palec
    Commented Dec 9, 2021 at 21:40
1

I'm late to the party but it looks like quite a bit more shortcuts have been added--at least in the GLUT version (mupdf-gl)

Thanks to @pp.ch.te, I had some strings to search for in the source code. I found the following semi-cryptic list with grep case platform/gl/gl-main.c (I assume there are similar lists for other platforms)

        case KEY_F1: showhelp = !showhelp; break;
        case 'a': toggle_annotate(); break;
        case 'o': toggle_outline(); break;
        case 'L': showlinks = !showlinks; break;
        case 'F': showform = !showform; break;
        case 'i': showinfo = !showinfo; break;
        case 'r': reload(); break;
        case 'q': glutLeaveMainLoop(); break;
        case 'C': currenttint = !currenttint; break;
        case 'I': currentinvert = !currentinvert; break;
        case 'e': currentseparations = !currentseparations; break;
        case 'f': toggle_fullscreen(); break;
        case 'w': shrinkwrap(); break;
        case 'W': auto_zoom_w(); break;
        case 'H': auto_zoom_h(); break;
        case 'Z': auto_zoom(); break;
        case 'z': set_zoom(number > 0 ? number : DEFRES, canvas_w/2, canvas_h/2); break;
        case '+': set_zoom(zoom_in(currentzoom), ui.x, ui.y); break;
        case '-': set_zoom(zoom_out(currentzoom), ui.x, ui.y); break;
        case '[': currentrotate -= 90; break;
        case ']': currentrotate += 90; break;
        case 'k': case KEY_UP: scroll_y -= 10; break;
        case 'j': case KEY_DOWN: scroll_y += 10; break;
        case 'h': case KEY_LEFT: scroll_x -= 10; break;
        case 'l': case KEY_RIGHT: scroll_x += 10; break;
        case 'b': number = fz_maxi(number, 1); while (number--) smart_move_backward(); break;
        case ' ': number = fz_maxi(number, 1); while (number--) smart_move_forward(); break;
        case ',': case KEY_PAGE_UP: currentpage -= fz_maxi(number, 1); break;
        case '.': case KEY_PAGE_DOWN: currentpage += fz_maxi(number, 1); break;
        case '<': currentpage -= 10 * fz_maxi(number, 1); break;
        case '>': currentpage += 10 * fz_maxi(number, 1); break;
        case 'g': jump_to_page(number - 1); break;
        case 'G': jump_to_page(fz_count_pages(ctx, doc) - 1); break;
        case 'm':
        case 't':
        case 'T':
        case '/':
        case '?':
        case 'N':
        case 'n':
        case 'p': password = fz_optarg; break;
        case 'r': currentzoom = fz_atof(fz_optarg); break;
        case 'I': currentinvert = !currentinvert; break;
        case 'W': layout_w = fz_atof(fz_optarg); break;
        case 'H': layout_h = fz_atof(fz_optarg); break;
        case 'S': layout_em = fz_atof(fz_optarg); break;
        case 'U': layout_css = fz_optarg; break;
        case 'X': layout_use_doc_css = 0; break;
        case 'J': enable_js = !enable_js; break;
        case 'A': aa_level = fz_atoi(fz_optarg); break;
        case 'C': currenttint = 1; tint_white = strtol(fz_optarg, NULL, 16); break;
        case 'B': currenttint = 1; tint_black = strtol(fz_optarg, NULL, 16); break;

I haven't tested all of them, but I did actually modified a couple shortcuts to things I found more intuitive and changed the increment for scrolling, etc. To my surprise, I found my changes actually worked after recompiling! (Probably not recommended since it may break your install of mupdf)

0
f   Toggle fullscreen.
w   Shrinkwrap window to fit page.
W   Fit page width to window.
H   Fit page height to window.
Z   Fit page size to window.
[number] z  Set zoom resolution in DPI.
+   Zoom in.
-   Zoom out.
[   Rotate counter-clockwise.
]   Rotate clockwise.
[arrows] or h, j, k, l  Pan page in small increments.
 
b   Smart move one screenful backward.
[space] Smart move one screenful forward.
[comma] or [page up]    Go one page backward.
[period] or [page down] Go one page forward.
[number] g  Go to page number.
G   Go to last page.
 
m   Save current page to navigation history.
t   Go back in navigation history.
T   Go forward in navigation history.
[number] m  Save current page in numbered bookmark.
[number] t  Go to numbered bookmark.
 
/   Start searching forward.
?   Start searching backward.
n   Continue searching forward.
N   Continue searching backward.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .