Function: doc-view-document->bitmap

doc-view-document->bitmap is a byte-compiled function defined in doc-view.el.gz.

Signature

(doc-view-document->bitmap PDF PNG PAGES)

Documentation

Convert a document file to bitmap images asynchronously.

Start by converting PAGES, and then the rest.

Source Code

;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defun doc-view-document->bitmap (pdf png pages)
  "Convert a document file to bitmap images asynchronously.
Start by converting PAGES, and then the rest."
  (if (null pages)
      (doc-view-pdf/ps->png pdf png)
    ;; We could render several `pages' with a single process if they're
    ;; (almost) consecutive, but since in 99% of the cases, there'll be only
    ;; a single page anyway, and of the remaining 1%, few cases will have
    ;; consecutive pages, it's not worth the trouble.
    (let ((rest (cdr pages)))
      (funcall doc-view-single-page-converter-function
	       pdf (format png (car pages)) (car pages)
               (lambda ()
                 (if rest
                     (doc-view-document->bitmap pdf png rest)
                   ;; Yippie, the important pages are done, update the display.
                   (clear-image-cache)
                   ;; For the windows that have a message (like "Welcome to
                   ;; DocView") display property, clearing the image cache is
                   ;; not sufficient.
                   (dolist (win (get-buffer-window-list (current-buffer) nil 'visible))
                     (with-selected-window win
                       (when (stringp (overlay-get (doc-view-current-overlay) 'display))
                         (doc-view-goto-page (doc-view-current-page)))))
                   ;; Convert the rest of the pages.
                   (doc-view-pdf/ps->png pdf png)))))))