Preview PDF as image in ranger

Ranger supports this (disabled by default) since v1.9.0 (see commit ab8fd9e). To enable this, update your scope.sh to the latest version. Note that this will overwrite your previewing configuration file:

ranger --copy-config=scope

Then find and uncomment the following in ~/.config/ranger/scope.sh:

# application/pdf)
#     pdftoppm -f 1 -l 1 \
#              -scale-to-x 1920 \
#              -scale-to-y -1 \
#              -singlefile \
#              -jpeg -tiffcompression jpeg \
#              -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
#         && exit 6 || exit 1;;

This works in ranger-stable 1.8.1:

pdf)
        try pdftoppm -jpeg -singlefile "$path" "${cached//.jpg}" && exit 6 || exit 1;;

enter image description here

I also had to create ~/.cache/ranger on my system manually.


You could try FIM ( http://www.nongnu.org/fbi-improved/#download ). It comes with fimgs which allows to view pdf in the console.

On my Arch i had to compile it myself and start it with FBFONT set to "fim://".

Tags:

Pdf

Ranger