pdf-tools icon indicating copy to clipboard operation
pdf-tools copied to clipboard

`pdf-links-action-perform` zooms the file on macos (hidpi problem?)

Open brabalan opened this issue 1 year ago • 6 comments

Describe the bug Running pdf-links-action-perform changes the display of the file, zooming it twofold. The annotations to links are at the "correct" location as if the file was not zoomed in.

Desktop

  • OS: MacOS Sequoia 15.3
  • Emacs Version: GNU Emacs 29.4 (build 2, aarch64-apple-darwin24.1.0, NS appkit-2575.20 Version 15.1 (Build 24B83)) of 2024-11-07
  • Poppler Version: 25.01.0

Your pdf-tools install

  • pdf-tools Version: installed with elpaca, current git (installed version: 1.1.0 30b5054)
  • pdf-tools customization / configuration that you use
(use-package pdf-tools
  :ensure t
  :mode ("\\.pdf\\'" . pdf-view-mode)
  :bind (:map pdf-view-mode-map ("C-c C-n" . my-pdf-highlight-with-note))
  :config
  (pdf-tools-install :no-query)
  (require 'my-pdf-annot))

(defun my-pdf-highlight-with-note (list-of-edges)
  (interactive (list (pdf-view-active-region t)))
  (let ((a (pdf-annot-add-highlight-markup-annotation list-of-edges)))
    (pdf-annot-edit-contents a)))

Additional context

  • opening this pdf, I see this Image

  • after hitting F, I see this Image

The AA link should be on "Digital Object Identifier 10.4230/LIPIcs.CONCUR.2022.7"

brabalan avatar Feb 10 '25 10:02 brabalan

I think this a known problem, see https://github.com/vedang/pdf-tools/pull/223 which tries to fix this (I haven't tried this fix) and it is also fixed on my fork https://github.com/aikrahguzar/pdf-tools if you want to try some additional features too.

aikrahguzar avatar Feb 10 '25 12:02 aikrahguzar

Thank you for the suggestion. I tried applying the patch, and the zoom still happens but now the annotations is not shown (it is out of bounds). I also tried your fork, but I get an error Symbol’s function definition is void: pdf-roll-page-overlay when calling pdf-links-read-link-action. (If you prefer I can directly file an issue in your repo.)

brabalan avatar Feb 10 '25 13:02 brabalan

Thank you for the suggestion. I tried applying the patch, and the zoom still happens but now the annotations is not shown (it is out of bounds). I also tried your fork, but I get an error Symbol’s function definition is void: pdf-roll-page-overlay when calling pdf-links-read-link-action. (If you prefer I can directly file an issue in your repo.)

Sorry about that. I pushed a commit that I think should fix the issue.

For the context pdf-view-roll-minor-mode is a minor mode that lets a pdf-tools buffer have more than one page visible simultaneously. That is the reason for my fork existing. Probably all the users of my fork have it turned on and then they won't see the issue. If you use my fork with pdf-view-roll-minor-mode turned off and run into issues please report them and I will try to fix them .

aikrahguzar avatar Feb 10 '25 15:02 aikrahguzar

Your version works, thanks. Small nitpick: the hint letter is very small (as if it was half the scale).

brabalan avatar Feb 10 '25 16:02 brabalan

Your version works, thanks. Small nitpick: the hint letter is very small (as if it was half the scale).

You can adjust the value of pdf-links-convert-pointsize-scale till you get something you like. We don't have an idea of font on the pdf so can take a big of experimentation.

aikrahguzar avatar Feb 10 '25 16:02 aikrahguzar

Doubling pdf-links-convert-pointsize-scale worked, thank you!

I’ll leave this issue open as the problem is still present in this version.

brabalan avatar Feb 11 '25 06:02 brabalan