HOWTO Read PDF Files in Console

I wrote about using Antiword for reading .doc files on the commandline yesterday. I think I get at least as oft pdf (portable document format) files attached to emails as I get .doc files. There are, of course, several alternatives for viewing pdf files when one is using X windows. You can, for example, use Evince, Kpdf or Xpdf for viewing the omnipresent pdf files.

I happen to read my email through a ssh connection on an Unix or sometimes a Linux system of my university. In order to view a pdf file, I have to save the attached file and use sftp to download the file to my desktop if I want to read it using a graphical pdf viewer.

Fortunately, there is a command line alternative even for reading pdf files! These can of course be used not only in a remote system over a ssh connection, but in any lightweight Linux system, even with a system with no X installed.

Ps2ascii uses Ghostscript for the conversion. It can convert both PostScript and PDF to ASCII text. It does not produce perfectly formatted output, but is certainly good enough for a quick & dirty conversion to have a glance at the textual content of a pdf file as the screenshot of Debian Reference shows.


Anonymous said...

I think you can convert pdf to html and then use any of the text web browser like w3m to view the resulting files. I have found a script here to do the same work for you. Thanks

Prasinos said...

The tool "pdftotext" from the package poppler-utils in another good alternative. It can even approximate the original layout of the document with the option "-layout".