Function: pdf-cache-get-image

pdf-cache-get-image is a natively compiled function defined in pdf-cache.el.

Signature

(pdf-cache-get-image PAGE MIN-WIDTH &optional MAX-WIDTH HASH)

Documentation

Return PAGE's PNG data as a string.

Return an image of at least MIN-WIDTH and, if non-nil, maximum width MAX-WIDTH and eql HASH value.

Remember that image was recently used.

Returns nil, if no matching image was found.

Source Code

;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-cache.el
(defun pdf-cache-get-image (page min-width &optional max-width hash)
  "Return PAGE's PNG data as a string.

Return an image of at least MIN-WIDTH and, if non-nil, maximum
width MAX-WIDTH and `eql' HASH value.

Remember that image was recently used.

Returns nil, if no matching image was found."
  (let ((cache pdf-cache--image-cache)
        image)
    ;; Find it in the cache.
    (while (and (setq image (pop cache))
                (not (pdf-cache--image-match
                      image page min-width max-width hash))))
    ;; Remove it and push it to the front.
    (when image
      (setq pdf-cache--image-cache
            (cons image (delq image pdf-cache--image-cache)))
      (pdf-cache--image/data image))))