File: doc-view.el.html
DocView is a document viewer for Emacs. It converts a number of
document formats (including PDF, PS, DVI, Djvu, ODF, EPUB, CBZ,
FB2, XPS and OXPS files) to a set of PNG (or TIFF for djvu) files,
one image for each page, and displays the images inside an Emacs
buffer. This buffer uses doc-view-mode which provides convenient
key bindings for browsing the document.
To use it simply open a document file with
C-x C-f ~/path/to/document RET
and the document will be converted and displayed, if your Emacs supports PNG
images. With C-c C-c you can toggle between the rendered images
representation and the source text representation of the document.
Since conversion may take some time all the PNG images are cached in a
subdirectory of doc-view-cache-directory and reused when you want to view
that file again. To reconvert a document hit g (doc-view-reconvert-doc)
when displaying the document. To delete all cached files use
doc-view-clear-cache. To open the cache with Dired, so that you can tidy
it out use doc-view-dired-cache.
When conversion is underway the first page will be displayed as soon as it
is available and the available pages are refreshed every
doc-view-conversion-refresh-interval seconds. If that variable is nil the
pages won't be displayed before conversion of the document finished
completely.
DocView lets you select a slice of the displayed pages. This slice
will be remembered and applied to all pages of the current
document. This enables you to cut away the margins of a document
to save some space. To select a slice you can use
doc-view-set-slice (bound to c s) which will query you for the
coordinates of the slice's top-left corner and its width and
height. A much more convenient way to do the same is offered by
the command doc-view-set-slice-using-mouse (bound to c m).
After invocation you only have to press mouse-1 at the top-left
corner and drag it to the bottom-right corner of the desired slice.
Even more accurate and convenient is to use
doc-view-set-slice-from-bounding-box (bound to c b) which uses
the BoundingBox information of the current page to set an optimal
slice. To reset the slice use doc-view-reset-slice (bound to c
r).
You can also search within the document. The command doc-view-search
(bound to C-s) queries for a search regexp and initializes a list of all
matching pages and messages how many match-pages were found. After that you
can jump to the next page containing a match with an additional C-s. With
C-r you can do the same, but backwards. To search for a new regexp give a
prefix arg to one of the search functions, e.g. by typing C-u C-s. The
searching works by using a plain text representation of the document. If
that doesn't already exist the first invocation of doc-view-search (or
doc-view-search-backward) starts the conversion. When that finishes and
you're still viewing the document (i.e. you didn't switch to another buffer)
you're queried for the regexp then.
Dired users can simply hit v on a document file. If it's a PS, PDF or DVI
it will be opened using doc-view-mode.
Defined variables (57)
doc-view--buffer-file-name | Only used internally. |
doc-view--current-cache-dir | Only used internally. |
doc-view--current-converter-processes | Only used internally. |
doc-view--current-files | Only used internally. |
doc-view--current-search-matches | Only used internally. |
doc-view--current-timer | Only used internally. |
doc-view--epub-stylesheet-watcher | File watcher for ‘doc-view-epub-user-stylesheet’. |
doc-view--image-file-pattern | The ‘format’ pattern of image file names. |
doc-view--image-type | The type of image in the current buffer. |
doc-view--mutool-pdf-outline-script | JS script to extract the PDF’s outline using mutool. |
doc-view--outline | Cached document outline, so that it is only computed once per document. |
doc-view--pending-cache-flush | Only used internally. |
doc-view--text-view-mode-abbrev-table | Abbrev table for ‘doc-view--text-view-mode’. |
doc-view--text-view-mode-hook | Hook run after entering ‘doc-view--text-view-mode’. |
doc-view--text-view-mode-map | Keymap for ‘doc-view--text-view-mode’. |
doc-view--text-view-mode-syntax-table | Syntax table for ‘doc-view--text-view-mode’. |
doc-view-cache-directory | The base directory, where the PNG images will be saved. |
doc-view-continuous | In Continuous mode reaching the page edge advances to next/previous page. |
doc-view-conversion-buffer | The buffer where messages from the converter programs go to. |
doc-view-conversion-refresh-interval | Interval in seconds between refreshes of the DocView buffer while converting. |
doc-view-djvused-program | Name of "djvused" program to generate imenu outline for DjVu files. |
doc-view-doc-type | The type of document in the current buffer. |
doc-view-dvipdf-program | Program to convert DVI files to PDF. |
doc-view-dvipdfm-program | Program to convert DVI files to PDF. |
doc-view-epub-font-size | Font size in points for EPUB layout. |
doc-view-epub-user-stylesheet | User stylesheet to use when converting EPUB documents to PDF. |
doc-view-ghostscript-device | Output device to give to ghostscript. |
doc-view-ghostscript-options | A list of options to give to ghostscript. |
doc-view-ghostscript-program | Program to convert PS and PDF files to PNG. |
doc-view-image-width | Default image width. |
doc-view-imenu-enabled | Whether to generate imenu outline for PDF and DjVu files. |
doc-view-imenu-flatten | Whether to flatten the list of sections in an imenu or show it nested. |
doc-view-imenu-title-format | Format spec for imenu’s display of section titles from docview documents. |
doc-view-menu | Menu for Doc View mode. |
doc-view-minor-mode | Non-nil if Doc-View minor mode is enabled. |
doc-view-minor-mode-hook | Hook run after entering or leaving ‘doc-view-minor-mode’. |
doc-view-minor-mode-map | Keymap used by ‘doc-view-minor-mode’. |
doc-view-minor-mode-menu | Menu for Doc View minor mode. |
doc-view-mode-map | Keymap used by ‘doc-view-mode’ when displaying a doc as a set of images. |
doc-view-mupdf-use-svg | Whether to use svg images for PDF files. |
doc-view-odf->pdf-converter-function | Function to call to convert an ODF file into a PDF file. |
doc-view-odf->pdf-converter-program | Program to convert any file type readable by OpenOffice.org to PDF. |
doc-view-paper-sizes | An alist from paper size names to dimensions. |
doc-view-pdf->png-converter-function | Function to call to convert a PDF file into a PNG file. |
doc-view-pdfdraw-program | Name of MuPDF’s program to convert PDF files to PNG. |
doc-view-pdftotext-program | Program to convert PDF files to plain text. |
doc-view-pdftotext-program-args | Parameters to give to the pdftotext command. |
doc-view-presentation-mode | Non-nil if Doc-View-Presentation mode is enabled. |
doc-view-presentation-mode-hook | Hook run after entering or leaving ‘doc-view-presentation-mode’. |
doc-view-ps2pdf-program | Program to convert PS files to PDF. |
doc-view-register-alist | Register alist containing only doc-view registers for current buffer. |
doc-view-resolution | Dots per inch resolution used to render the documents. |
doc-view-saved-settings | Doc-view settings saved while in some other mode. |
doc-view-scale-internally | Whether we should try to rescale images ourselves. |
doc-view-single-page-converter-function | Function to call to convert a single page of the document to a bitmap file. |
doc-view-tool-bar-map | Like the default ‘tool-bar-map’, but with additions for DocView. |
doc-view-unoconv-program | Program to convert any file type readable by OpenOffice.org to PDF. |
Defined functions (99)
Defined faces (1)
doc-view-svg-face | Face used for SVG images. See ‘doc-view-mupdf-use-svg’. Only background and foreground colors are used as the SVG image’s descriptors; see (info "(elisp) SVG Images"). Custom values may cause low-contrast issues with certain documents. |