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-nameOnly used internally.
doc-view--current-cache-dirOnly used internally.
doc-view--current-converter-processesOnly used internally.
doc-view--current-filesOnly used internally.
doc-view--current-search-matchesOnly used internally.
doc-view--current-timerOnly used internally.
doc-view--epub-stylesheet-watcherFile watcher for ‘doc-view-epub-user-stylesheet’.
doc-view--image-file-patternThe ‘format’ pattern of image file names.
doc-view--image-typeThe type of image in the current buffer.
doc-view--mutool-pdf-outline-scriptJS script to extract the PDF’s outline using mutool.
doc-view--outlineCached document outline, so that it is only computed once per document.
doc-view--pending-cache-flushOnly used internally.
doc-view--text-view-mode-abbrev-tableAbbrev table for ‘doc-view--text-view-mode’.
doc-view--text-view-mode-hookHook run after entering ‘doc-view--text-view-mode’.
doc-view--text-view-mode-mapKeymap for ‘doc-view--text-view-mode’.
doc-view--text-view-mode-syntax-tableSyntax table for ‘doc-view--text-view-mode’.
doc-view-cache-directoryThe base directory, where the PNG images will be saved.
doc-view-continuousIn Continuous mode reaching the page edge advances to next/previous page.
doc-view-conversion-bufferThe buffer where messages from the converter programs go to.
doc-view-conversion-refresh-intervalInterval in seconds between refreshes of the DocView buffer while converting.
doc-view-djvused-programName of "djvused" program to generate imenu outline for DjVu files.
doc-view-doc-typeThe type of document in the current buffer.
doc-view-dvipdf-programProgram to convert DVI files to PDF.
doc-view-dvipdfm-programProgram to convert DVI files to PDF.
doc-view-epub-font-sizeFont size in points for EPUB layout.
doc-view-epub-user-stylesheetUser stylesheet to use when converting EPUB documents to PDF.
doc-view-ghostscript-deviceOutput device to give to ghostscript.
doc-view-ghostscript-optionsA list of options to give to ghostscript.
doc-view-ghostscript-programProgram to convert PS and PDF files to PNG.
doc-view-image-widthDefault image width.
doc-view-imenu-enabledWhether to generate imenu outline for PDF and DjVu files.
doc-view-imenu-flattenWhether to flatten the list of sections in an imenu or show it nested.
doc-view-imenu-title-formatFormat spec for imenu’s display of section titles from docview documents.
doc-view-menuMenu for Doc View mode.
doc-view-minor-modeNon-nil if Doc-View minor mode is enabled.
doc-view-minor-mode-hookHook run after entering or leaving ‘doc-view-minor-mode’.
doc-view-minor-mode-mapKeymap used by ‘doc-view-minor-mode’.
doc-view-minor-mode-menuMenu for Doc View minor mode.
doc-view-mode-mapKeymap used by ‘doc-view-mode’ when displaying a doc as a set of images.
doc-view-mupdf-use-svgWhether to use svg images for PDF files.
doc-view-odf->pdf-converter-functionFunction to call to convert an ODF file into a PDF file.
doc-view-odf->pdf-converter-programProgram to convert any file type readable by OpenOffice.org to PDF.
doc-view-paper-sizesAn alist from paper size names to dimensions.
doc-view-pdf->png-converter-functionFunction to call to convert a PDF file into a PNG file.
doc-view-pdfdraw-programName of MuPDF’s program to convert PDF files to PNG.
doc-view-pdftotext-programProgram to convert PDF files to plain text.
doc-view-pdftotext-program-argsParameters to give to the pdftotext command.
doc-view-presentation-modeNon-nil if Doc-View-Presentation mode is enabled.
doc-view-presentation-mode-hookHook run after entering or leaving ‘doc-view-presentation-mode’.
doc-view-ps2pdf-programProgram to convert PS files to PDF.
doc-view-register-alistRegister alist containing only doc-view registers for current buffer.
doc-view-resolutionDots per inch resolution used to render the documents.
doc-view-saved-settingsDoc-view settings saved while in some other mode.
doc-view-scale-internallyWhether we should try to rescale images ourselves.
doc-view-single-page-converter-functionFunction to call to convert a single page of the document to a bitmap file.
doc-view-tool-bar-mapLike the default ‘tool-bar-map’, but with additions for DocView.
doc-view-unoconv-programProgram to convert any file type readable by OpenOffice.org to PDF.

Defined functions (99)

doc-view--current-cache-dir()
doc-view--djvu-outline(&optional FILE-NAME)
doc-view--epub-reconvert(&optional EVENT)
doc-view--imenu-subtree(OUTLINE ACT)
doc-view--outline(&optional FILE-NAME)
doc-view--parse-djvu-outline(BOOKMARK &optional LEVEL)
doc-view--pdf-outline(&optional FILE-NAME)
doc-view--revert-buffer(ORIG-FUN &rest ARGS)
doc-view--text-view-mode()
doc-view-already-converted-p()
doc-view-bookmark-jump(BMK)
doc-view-center-page-horizontally()
doc-view-center-page-vertically()
doc-view-clear-cache()
doc-view-convert-current-doc()
doc-view-current-cache-doc-pdf()
doc-view-current-page(&optional WIN)
doc-view-custom-set-epub-font-size(OPTION-NAME NEW-VALUE)
doc-view-custom-set-epub-user-stylesheet(OPTION-NAME NEW-VALUE)
doc-view-desktop-save-buffer(DESKTOP-DIRNAME)
doc-view-dired-cache()
doc-view-display(BUFFER &optional FORCE)
doc-view-djvu->tiff-converter-ddjvu(DJVU TIFF PAGE CALLBACK)
doc-view-doc->txt(TXT CALLBACK)
doc-view-document->bitmap(PDF PNG PAGES)
doc-view-dvi->pdf(DVI PDF CALLBACK)
doc-view-enlarge(FACTOR)
doc-view-fallback-mode()
doc-view-first-page()
doc-view-fit-height-to-window()
doc-view-fit-page-to-window()
doc-view-fit-width-to-window()
doc-view-fit-window-to-page()
doc-view-get-bounding-box()
doc-view-goto-page(PAGE)
doc-view-guess-paper-size(IW IH)
doc-view-imenu-index(&optional FILE-NAME GOTO-PAGE-FN)
doc-view-imenu-setup()
doc-view-insert-image(FILE &rest ARGS)
doc-view-intersection(L1 L2)
doc-view-jump-to-register(REGISTER)
doc-view-kill-proc()
doc-view-kill-proc-and-buffer()
doc-view-last-page()
doc-view-make-safe-dir(DIR)
doc-view-menu(ARG1)
doc-view-minor-mode(&optional ARG)
doc-view-minor-mode-menu(ARG1)
doc-view-mode()
doc-view-mode-maybe()
doc-view-mode-p(TYPE)
doc-view-new-search()
doc-view-new-window-function(WINPROPS)
doc-view-next-line-or-next-page(&optional ARG)
doc-view-next-page(&optional ARG)
doc-view-odf->pdf-converter-soffice(ODF CALLBACK)
doc-view-odf->pdf-converter-unoconv(ODF CALLBACK)
doc-view-open-text()
doc-view-page-to-register(REGISTER)
doc-view-pdf->png-converter-ghostscript(PDF PNG PAGE CALLBACK)
doc-view-pdf->png-converter-mupdf(PDF PNG PAGE CALLBACK)
doc-view-pdf->txt(PDF TXT CALLBACK)
doc-view-pdf-password-protected-ghostscript-p(PDF)
doc-view-pdf-password-protected-pdfdraw-p(PDF)
doc-view-pdf/ps->png(PDF-PS PNG)
doc-view-pdfdraw-program-subcommand()
doc-view-presentation()
doc-view-presentation--propagate-pn(SRC-DATA PN)
doc-view-presentation-exit()
doc-view-presentation-mode(&optional ARG)
doc-view-previous-line-or-previous-page(&optional ARG)
doc-view-previous-page(&optional ARG)
doc-view-ps->pdf(PS PDF CALLBACK)
doc-view-ps->png-converter-ghostscript(PDF PNG PAGE CALLBACK)
doc-view-reconvert-doc()
doc-view-reset-slice()
doc-view-restore-desktop-buffer(FILE NAME MISC)
doc-view-revert-buffer(&optional IGNORE-AUTO NOCONFIRM PRESERVE-MODES)
doc-view-scale-adjust(FACTOR)
doc-view-scale-bounding-box(PS IW IH BB)
doc-view-scale-reset()
doc-view-scroll-down-or-previous-page(&optional ARG)
doc-view-scroll-up-or-next-page(&optional ARG)
doc-view-search(NEW-QUERY &optional BACKWARD)
doc-view-search-backward(NEW-QUERY)
doc-view-search-internal(REGEXP FILE)
doc-view-search-next-match(ARG)
doc-view-search-no-of-matches(LIST)
doc-view-search-previous-match(ARG)
doc-view-sentinel(PROC EVENT)
doc-view-set-doc-type()
doc-view-set-slice(X Y WIDTH HEIGHT)
doc-view-set-slice-from-bounding-box(&optional FORCE-PAPER-SIZE)
doc-view-set-slice-using-mouse()
doc-view-set-up-single-converter()
doc-view-shrink(FACTOR)
doc-view-sort(A B)
doc-view-start-process(NAME PROGRAM ARGS CALLBACK)
doc-view-toggle-display()

Defined faces (1)

doc-view-svg-faceFace 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.