From eefd77b690e5ee7ff15b278d9ad067f7820902db Mon Sep 17 00:00:00 2001 From: Jun Inoue Date: Thu, 9 Mar 2023 10:50:43 +0900 Subject: [PATCH 1/2] Fix height handling At least since Emacs 27.2, image-set-window-vscroll specifies VSCROLL in pixels, not lines. --- org-pdftools.el | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/org-pdftools.el b/org-pdftools.el index 5ff0a55..3356646 100644 --- a/org-pdftools.el +++ b/org-pdftools.el @@ -175,19 +175,11 @@ Can be one of highlight/underline/strikeout/squiggly." (with-selected-window (org-noter--get-doc-window) (image-set-window-vscroll - (round - (/ - (* - (string-to-number height) - (cdr (pdf-view-image-size))) - (frame-char-height)))))) + (* (string-to-number height) + (cdr (pdf-view-image-size)))))) (image-set-window-vscroll - (round - (/ - (* - (string-to-number height) - (cdr (pdf-view-image-size))) - (frame-char-height)))))) + (* (string-to-number height) + (cdr (pdf-view-image-size)))))) (when (and annot-id (not (string-empty-p annot-id))) (if (bound-and-true-p org-noter--session) From a34c6549aa5fcdd12d076c95ae6ed2835b50d1bb Mon Sep 17 00:00:00 2001 From: Jun Inoue Date: Thu, 16 Mar 2023 18:06:20 +0900 Subject: [PATCH 2/2] Fix height handling in org-pdftools-get-link --- org-pdftools.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/org-pdftools.el b/org-pdftools.el index 3356646..df6320d 100644 --- a/org-pdftools.el +++ b/org-pdftools.el @@ -264,11 +264,9 @@ Can be one of highlight/underline/strikeout/squiggly." 'edges))) (t (/ - (* - (or (image-mode-window-get - 'vscroll) - 0) - (frame-char-height)) + (or (image-mode-window-get + 'vscroll) + 0) (float (cdr (pdf-view-image-size))))))) ;; pdf://path::page++height_percent;;annot_id\\|??search-string