Solution 1:

Hi I think that you don't need to write a program for your purpose I mean reading pdf file in console mode because less command already do it for you. So use it and just enjoy it.

less "the name of pdf file"

Solution 2:

Ok, you asked to know even "crappy" ones. Here are two (decide yourself about their respective crappiness):

First: Ghostscript's txtwrite output device

 gs \
   -dBATCH \
   -dNOPAUSE \
   -sDEVICE=txtwrite \
   -sOutputFile=- \
   /path/to/your/pdf

Second: XPDF's pdftotext CLI utility (better than Ghostscript):

 pdftotext \
   -f 13 \
   -l 17 \
   -layout \
   -opw supersecret \
   -upw secret \
   -eol unix \
   -nopgbrk \
   /path/to/your/pdf
   - |less

This will display the page range 13 (first page) to 17 (last page), preserve the layout of a double-password protected named PDF file (using user and owner passwords secret and supersecret), with Unix EOL convention, but without inserting pagebreaks between PDF pages, piped through less...

pdftotext -h displays all available commandline options.

Of course, both tools only work for the text parts of PDFs (if they have any). Oh, and mathematical formula also won't work too well... ;-)


Edit: I had mis-typed the command above (originally using pdftops instead of pdftotext).

Solution 3:

There is also the green PDF viewer. There is a demo on YouTube.

Solution 4:

By the way, i m always in the same situation, and I use mc (midnight commander) which handles text pdf's very well... Just view the file (F3) in mc