Read contents of the pdf using vim

Rohit Singhal picture Rohit Singhal · Jan 22, 2014 · Viewed 8.4k times · Source

How can we read contents of the pdf file using vim command in the terminal? I have tried using pdftk by uncompressing it but still its not working for me. Is there any other way to decrypt or decode the pdf so that we can read by the terminal in any Linux flavour using vim.

Answer

Conner picture Conner · Jan 22, 2014

If you want to read the pdf as text you can try the pdftotext command, though it won't always be beautiful. If you'd like vim to open pdf files in a pdf reader you can use something in your .vimrc like

au BufRead *.pdf sil exe "!xdg-open " . shellescape(expand("%:p")) | bd | let &ft=&ft | redraw!