ranger is a great terminal-based file manager.
For a long time, I used pdftoppm
for image-based PDF previews which is the recommended approach.
However, I found it was difficult to install pdftoppm
everywhere (particularly, macos) and finally turned to MuPDF, which was much easier to get.
In order to use MuPDF, I changed the PDF case within the handle_image()
function inside scope.sh
to the following:
application/pdf)
mutool draw -F png -o "${IMAGE_CACHE_PATH}" "${FILE_PATH}" 1 \
&& exit 6 || exit 1;;
Incidentally, it looks like ranger has started to use mutool draw
for the PDF to txt conversion (see here).