DocView mode is a major mode for viewing DVI, PostScript (PS), PDF, OpenDocument, and Microsoft Office documents. It provides features such as slicing, zooming, and searching inside documents. It works by converting the document to a set of images using the gs (GhostScript) command and other external tools 1, and displaying those images.
When you visit a document file that can be displayed with DocView
mode, Emacs automatically uses DocView mode 2. As an exception, when you visit a PostScript file, Emacs
switches to PS mode, a major mode for editing PostScript files as
text; however, it also enables DocView minor mode, so you can type
C-c C-c to view the document with DocView. In either DocView
mode or DocView minor mode, repeating C-c C-c
(doc-view-toggle-display
) toggles between DocView and the
underlying file contents.
You can explicitly enable DocView mode with the command M-x
doc-view-mode
. You can toggle DocView minor mode with M-x
doc-view-minor-mode
.
When DocView mode starts, it displays a welcome screen and begins formatting the file, page by page. It displays the first page once that has been formatted.
To kill the DocView buffer, type k
(doc-view-kill-proc-and-buffer
). To bury it, type q
(quit-window
).
[1] gs
is
a hard requirement. For DVI files, dvipdf
or dvipdfm
is
needed. For OpenDocument and Microsoft Office documents, the
unoconv
tool is needed.
[2] The needed external tools for the document type must be available, and Emacs must be running in a graphical frame and have PNG image support. If any of these requirements is not fulfilled, Emacs falls back to another major mode.