llpp

From ArchWiki

Warning: In the git repository the files were deleted and replaced, but older commits still retain all previous code. https://repo.or.cz/llpp.git/tree/04431d79a40dcc0215f87a2ad577f126a85c1e61
Note: The repo is forked and maintained in AUR. https://github.com/criticic/llpp

llpp is a lightweight, fast and featureful PDF, EPUB, XPS and CBZ viewer based on MuPDF.

Installation

Install the llppAUR package.

Usage

llpp uses keyboard shortcuts and the mouse to navigate through a document. By default, pressing F1 or h will bring up a help page where all other key bindings are described.

Check out the following page for the full help text.

Configuration

llpp uses a configuration file to store settings: $XDG_CONFIG_HOME/llpp.conf or ~/.config/llpp.conf. This file stores the following:

  1. Application defaults.
  2. File-by-file user preferences (e.g. the last page viewed).

Per-document options

Pressing i will enter information mode, where you can examine and modify display settings for the current document.

Alternately, pressing -X (where X is one of the tunable options shown in the help screen) allows you to set a single setting directly.

UI Font

One can set the font used by llpp by indicating the size and filename in the configuration. For example:

<llppconfig>
  <ui-font size='16'><![CDATA[/usr/share/fonts/TTF/DejaVuSansMono.ttf]]></ui-font>
  <defaults ... >
  ...
  </defaults>
</llppconfig>

Custom key bindings

It is possible to configure key bindings. For example, to disable Esc exiting llpp, add the keymap element in between the defaults tags as follows:

<llppconfig>
  <defaults ... >
    <keymap mode='view'>
      <map in='esc' out=/>
    </keymap>
  </defaults>
</llppconfig>

More examples can be found in llpp's example file keys.txt[dead link 2022-09-21 ⓘ]. For vi-like key bindings, see this example.

Tip: Bindings can be set for particular modes, including birdseye, global, help, info, listview, outline, and view. Example here.

Save annotations to PDF

You can annotate a PDF file by right clicking while holding Shift. To allow saving of annotations, add

savepath-command='echo %s'

to your llpp.conf. After annotating the file, save the changes by pressing w. This echos the current PDF file path to the savepath-command option.

Opening links in web browser

By default, llpp will not open links in the default browser. The uri-launcher option in llpp.conf is responsible for handling this action. To open links in your default web browser, set it to:

uri-launcher='xdg-open "%s"'

Tips and Tricks

Reload File

A document can be reloaded in three ways:

  • Pressing the r key
  • Sending a HUP signal to the llpp process
$ killall -SIGHUP llpp
  • Using the "remote" interface (see below)

Multiple Columns

For side-by-side 2-page viewing, press -C2 (or set columns to 2 in info mode).

If the page offset is wrong (left-hand page showing on the right-hand side), set columns to 2,1,0.

A unique feature of llpp is being able to split a single page down the middle by setting columns to -2. Use -3 to split a 3-column document.

Remote Interface

The following commands will setup the remote interface and use it to reload the file "image.pdf".

$ mkfifo /tmp/llpp.remote
$ llpp -remote /tmp/llpp.remote image.pdf & disown
$ sleep 1
$ echo reload >/tmp/llpp.remote

There are eight remote commands:

  • reload - reload
  • quit - quit
  • goto <page-number> <x-coordinate> <y-coordinate> - goto
  • goto1 <page-number> <relative-y-coordinate> - goto
  • gotor <file-name> <page-number> - goto other document
  • gotord <file-name> <remote-destination> - goto named destination within the other document
  • rect <pageno> <color> <x0> <y0> <x1> <y1> - draw a rectangle
  • activatewin - raise and switch to llpp's window

Inverse search using Synctex and Vim/Emacs

To use the synctex capability of llpp, add the line bellow to your ~/.config/llpp.conf under the defaults tag:

<defaults
    ...
    synctex-command='SyncTeX-inverse.sh'
    ...>
    ...
</defaults>

where SyncTeX-inverse.sh is the script bellow

#!/bin/bash
pdf_file=$1
page=$(($2 + 1)) # The page number star at zero in llpp
x=$3
y=$4

# for vim
synctex edit -o "$page:$x:$y:$pdf_file" \
       -x "gvim --servername synctex --remote-wait-silent +%{line} '%{input}'"

# for emacs
# synctex edit -o "$page:$x:$y:$pdf_file" -x "emacsclient +%{line} '%{input}'" 

Make sure SyncTeX-inverse.sh is an executable script and add it to your PATH environment variable. To use the synctex command you will need texlive-bin package from the official Arch repositories.

See also