Is there a way to quickly browse multiple pdfs in a directory?
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?
Solution 1:
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.
Solution 2:
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.
Solution 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.
Solution 4:
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