How does less display PDFs?
Your distribution is probably using the popular lesspipe.sh
script. Check the LESSOPEN
environment variable.
This script exists in many variations. I’m looking at the Gentoo version. In it, you’ll find the following line:
*.ps|*.pdf) ps2ascii "$1" || pstotext "$1" || pdftotext "$1" ;;
That means it will try those commands in the order displayed. $1
is the file name.
Another version uses the following command:
pdftohtml -stdout "$t" | parsehtml -