View documents (PDF/PostScript/DVI) inside Emacs

Posted: August 22, 2007 in Emacs
Tags: , , , ,

Today I wrote an extension for emacs that lets you view pdf, ps or dvi documents in emacs. It’s named doc-view.el and I posted it to the emacs-sources mailing list (here it is). But I recommend that you get the latest version by cloning my Git repository.

A description of doc-view.el and how to get it can be found on my homepage.

UPDATE: doc-view is official part of Emacs and the default viewer for DVI and PDF files.

Comments
  1. gnugalaxy says:

    Wow, cool! I’ve been learning and learning elisp for so long that I didn’t learn at all hehe.. But here, you have done it! nice :) I’ll use it and come back.

  2. Tassilo Horn says:

    Thanks a lot for the compliments!

    Bye,
    Tassilo

  3. Pablo says:

    Great add-on :)
    ive been using it for a while and im missing only one thing. Rescaling images. Sometimes the pdf doc’s don’t fit in the window.

    Pablo

  4. Tassilo Horn says:

    With the doc-view version in Emacs CVS (23), you can enlarge and shrink the doc with + and -.

  5. This is very nice. I’ve been thinking of writing a similar reader that uses pdftotext for emacs buffer viewing, although there are obvious limitations. It would be nice to see a mode that allows options for conversion to text, tex, and png. The problem with png is that the file is no longer searchable. Maybe one day there will be a conkeroresque pdf viewer ;)

    • Tassilo Horn says:

      Hey Fred,
      doc-view allows both conversion to text (simply hit C-c C-t when viewing the doc as PNG images), and searching (C-s and C-r, mimicing the isearch behavior).
      Bye,
      Tassilo

  6. AC says:

    C-c C-t does not show the document source – it just shows document text (which is frustrating). How can I fix disable doc-view.el so I can actually see the pdf document source?

  7. Jeff Martens says:

    Can I disable DocView altogether? It’s inconvenient to have to manually switch to fundamental-mode every time I need to look at the beginning of a PDF.

    With Doc files I’m much more interested in hexlify-buffer than rendering. I have other tools to do that. Thanks!

    • Tassilo Horn says:

      Sure, simply remove its entry from auto-mode-alist:

      (setq auto-mode-alist
      (remove '("\\.\\(?:PDF\\|DVI\\|OD[FGPST]\\|DOCX?\\|XLSX?\\|PPTX?\\|pdf\\|dvi\\|od[fgpst]\\|docx?\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe)
      auto-mode-alist))

      However, if you generally want to see pdf files and other docs in a hex editor, then I’d just add a new (overriding) entry that enables emacs’ hex editor (hexl-mode):

      (add-to-list 'auto-mode-alist
      '("\\.\\(?:PDF\\|DVI\\|DOCX?\\|XLSX?\\|PPTX?\\|pdf\\|dvi\\|docx?\\|xlsx?\\|pptx?\\)\\'" . hexl-mode))

      Bye,
      Tassilo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s