21

I often generate directories full of PDFs. I want to quickly flip through them as though they are pictures.

Nautilus will create thumbnails of the PDFs that I can enlarge using ctrl= but they never get large enough to see the detail that I want.

Is there a better way?

6 Answers6

8

I like @Glutanimate answer since it uses a real pdf viewer. I have an alternative that allows viewing any list of files (including pdf) as a presentation, on fullscreen if needed:

impressive

  • Install it

    sudo apt-get install impressive

  • Then, from a terminal in the directory containing your pdfs:

    impressive -T0 -w *.pdf

  • It will display a presentation of your pdf files. the -T0 option removes transitions (or, equivalently, -t None), and the -w wraps the presentation (you can return to 1st slide from the last one).

    You may want to use the -f switch to avoid starting in fullscreen mode (anyway you can toggle to fullscreen hitting the "f" key).

    For zooming, position your mouse where you want to zoom in, and hit "z".

Otherwise I am just discovering the Zathura pdf reader, it's highly customizable, I suspect there might be a way to write a plugin and bind keys to switch to the next pdf.

  • 1
    with gnome-sushi in a useless state, this is a really nice solution... and maybe better than gnome-sushi in the end. – krumpelstiltskin Feb 03 '17 at 10:20
  • Thanks. This is very much impressive – Garini Nov 19 '19 at 17:03
  • 1
    How does one get this? On my Ubuntu distro sudo apt-get install impressive returns E: Unable to locate package impressive. – sh37211 Jan 26 '22 at 17:13
  • 1
    @sh37211 impressive is not present in ubuntu 20.04 repositories, but in 22.04 it is. https://packages.ubuntu.com/search?keywords=impressive – luca76 May 11 '22 at 13:25
6

I recommend gnome-sushi, it's in the default repositories and works as you describe. After installing it, you just select the PDF in Nautilus and tap the space bar. Gnome-sushi will then display the PDF in a popup window at 100% zoom, which you can scroll through if you like.

The best thing is it also works on many other file types, so you can start playing a song, quick-preview an image, etc, with a tap of the space bar. Highly recommended for it's utility and one of those programs which I immediately install on any new machine.

Tom Brossman
  • 13,111
3

If you don't manage to find a better solution you could give this script a try:

#!/bin/bash

# NAME:         pdfwalker  
# AUTHOR:       (c) 2014 Glutanimate <https://github.com/Glutanimate/>
# DESCRIPTION:  Invoke one pdf file at a time
# DEPENDENCIES: mupdf
# LICENSE:      GNU GPLv3 (http://www.gnu.de/documents/gpl-3.0.en.html)        

############# Functions ###############

gui_notify(){
  notify-send -i application-pdf "PDF Walker" "$1"
  echo "$1"
}

arg_compose_filearray(){
    # recursively add pdf files and folders in given arguments to array
    unset Files
    FileCountCurrent="1"
    while IFS= read -r -d $'\0' File; do
        if [[ ! "$(file -ib "$File")" == *application/pdf* ]]
          then
              echo "Error: '$File' is not a pdf file. Ignoring."
              continue
        fi
        Files[FileCountCurrent++]="$File"
    done < <(find "$@" -type f -name '*.pdf' -print0 | sort -z --version-sort)
    FileCountTotal="${#Files[@]}"
}

arg_check(){
  if [[ "$FileCountTotal" = "0" ]]; then
    gui_notify "ERROR: No PDF files found."
    echo "Exiting..."
    exit 1
  fi
}

############## Checks #################

arg_compose_filearray "$@"
arg_check

################ Main #################

FileCountCurrent="1"
for File in "${Files[@]}"; do
  echo "Opening file $FileCountCurrent of $FileCountTotal:"
  echo "$File"
  mupdf "$File" > /dev/null 2>&1
  ((FileCountCurrent++))
done

echo "Done."

Installation

Copy and paste the contents of the code box above into a new empty text file, save it, and mark the script as executable via the Properties menu of your file manager.

Make sure to install all dependencies:

sudo apt-get install mupdf

Usage

pdfwalker <pdf files or directories>

For instance:

pdfwalker "~/Downloads/PDF" "~/Documents/Scans"

The script will recursively find all PDF files in the selected directories and open them one after another with mupdf. To switch to the next file in line, simply close the current mupdf window (Q). If you want to exit the script completely you can terminate it from the terminal via CTRL +C.

Glutanimate
  • 21,393
2

I tried some of the aforementioned solutions, but they did not work for me.

So I crafted this simple one-liner:

find ./pdf-folder/ -iname '*\.pdf' | xargs -n1 mupdf

It only requires mupdf (package findutils contains the find command is marked essential in Debian and Ubuntu)

Usage:

  • Press q inside the mupdf viewer to get the next document
  • Switch back to the terminal and press Ctrl-C to break the loop
madmuffin
  • 141
  • 3
0

I had a similar problem and the CLI file manager ranger worked best for me.

Install via sudo apt install ranger

I have it set up to preview PDFs as text. Here a sample screenshot:

enter image description here

But it will depend on your PDFs. Mine have little text (generated bills) and the text preview works very well and fast.

I can go from file to file with the arrow keys.

some user
  • 465
  • 5
  • 12
0

You could search through the terminal, using grep to look for whatever words you're interested in, as in

grep "word" *

should search all files in the current dir for word.

PDF's should have some text in them so this should work, maybe/maybe not run through strings then piped to grep, as in

strings -f * | grep "word"

unless the PDF's are all images.


Or, use an "e-library" program like Calibre

This screenshot looks promising: enter image description here

Xen2050
  • 8,705