Function: pdf-info-renderpage-text-regions

pdf-info-renderpage-text-regions is a natively compiled function defined in pdf-info.el.

Signature

(pdf-info-renderpage-text-regions PAGE WIDTH SINGLE-LINE-P &optional SELECTION-STYLE FILE-OR-BUFFER &rest REGIONS)

Documentation

Highlight text on PAGE with width WIDTH using REGIONS.

REGIONS is a list determining foreground and background color and the regions to render. So each element should look like (FG BG
(LEFT TOP RIGHT BOT) (LEFT TOP RIGHT BOT) ... ) . The
rendering is text-aware and is controlled by SELECTION-STYLE.

If SINGLE-LINE-P is non-nil, the edges in REGIONS are each supposed to be limited to a single line in the document. Setting this, if applicable, avoids rendering problems.

For the other args see pdf-info-renderpage.

Return the data of the corresponding PNG image.

Source Code

;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-info.el
(defun pdf-info-renderpage-text-regions (page width single-line-p
                                              &optional selection-style file-or-buffer
                                              &rest regions)
  "Highlight text on PAGE with width WIDTH using REGIONS.

REGIONS is a list determining foreground and background color and
the regions to render. So each element should look like \(FG BG
\(LEFT TOP RIGHT BOT\) \(LEFT TOP RIGHT BOT\) ... \) . The
rendering is text-aware and is controlled by SELECTION-STYLE.

If SINGLE-LINE-P is non-nil, the edges in REGIONS are each
supposed to be limited to a single line in the document.  Setting
this, if applicable, avoids rendering problems.

For the other args see `pdf-info-renderpage'.

Return the data of the corresponding PNG image."

  (when (consp file-or-buffer)
    (push file-or-buffer regions)
    (setq file-or-buffer nil))

  (apply #'pdf-info-renderpage
    page width file-or-buffer
    (apply #'append
      `(:selection-style ,selection-style)
      (mapcar (lambda (elt)
                `(:foreground ,(pop elt)
                  :background ,(pop elt)
                  ,@(cl-mapcan (lambda (edges)
                                 `(,(if single-line-p
                                        :highlight-line
                                      :highlight-text)
                                   ,edges))
                               elt)))
              regions))))