Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was just wondering if there is a way to display content of a PDF file inside terminal, just like doing less file.txt but with PDF files.

share|improve this question

migrated from stackoverflow.com Oct 17 '09 at 22:13

This question came from our site for professional and enthusiast programmers.

3 Answers 3

There are tools that allow to extract text from PDF files (Google for it) but IMHO there are cases where this will simply be not possible (imagine a PDF that contains only images).

share|improve this answer

The program pdftotext, which comes as a part of xpdf, can convert a PDF to text. There is also a program called lesspipe, which can be set as a preprocessor for less so that if you have pdftotext or something like it installed, you can just use less with PDF (and many other types of files).

share|improve this answer

You can use less to view pdf text in terminal. It works quite well but garbles do happen.

share|improve this answer
    
At least use strings filename.pdf | less –  Kevin Panko Jan 6 at 20:26
    
That won't work at all if the streams are compressed. –  sudo Jan 6 at 20:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.