How can I use doc view in emacs -nw?

393 Views Asked by At

Suppose I want to open the pdf file in the emacs. It is very easy in the emacs gui by using C-x C-f. But when I use it in emacs -nw. It shows the code instead of document. How can I do that? Thank you.

1

There are 1 best solutions below

0
On

If you just want to read the pdf as text you can dot it with pdf2txt and this function:

(defun open-pdf-in-txt (arg)
    (interactive "fpdf: ")
    (shell-command
     (format (concat "pdftotext " (replace-regexp-in-string " " "?\ " arg) " -layout")))
    (find-file (replace-regexp-in-string "pdf" "txt" arg)))