vedang / pdf-tools

Emacs support library for PDF files.
https://pdftools.wiki
GNU General Public License v3.0
641 stars 90 forks source link

wrong position of annotations #146

Closed svictor9 closed 2 years ago

svictor9 commented 2 years ago

I use pdf-tools quite intensively and usually without problem. Thanks for maintining this very useful software!

Now, I run into a problem, specifically with the attached file. The annotations are misplaced with respect to the underlying text data.

The orange highlight and underline at the bottom of the page were produced using a e-reader device. They are correctly positioned visually, but when I try to click on the annotation, it's not there where it seems to be but lower and to the left. The main problem with this is that when I extract the annotations contents in org-noter with org-noter-create-skeleton, the extracted text is not the one that is visually highlighted but some text that comes later on the page.

The blue underline at the top of the page was produced in pdf-tools by trying to underline the first two lines on the page. As you can see, this time the underline is not visually aligned with the text.

There is probably some peculiarity in this pdf file. But Evince manages to highlight the text correctly (it's visually where it should be). And, my e-reader extracts the annotated contents correctly (it correctly outputs the underlined/highlighted text of the two orange annotations). I hope that pdf-tools can also find the way to piece together the visual and textual layers.

wrongAnnotText.pdf

9viz commented 2 years ago

I'm confident that this is a duplicate of #143. Can you check if the patch posted in the OP fixes the issue for you? It works for me.

svictor9 commented 2 years ago

Indeed, that's the issue! I had read #143 but did not fully understand it. The patch solves the problem. Thanks!

9viz commented 2 years ago

9 Sept 2022, 00:56 by @.***:

Indeed, that's the issue! I had read > #143 https://github.com/vedang/pdf-tools/issues/143> but did not fully understand it. The patch solves the problem. Thanks!

Shame on me for not being clear!  Thanks for testing!

vedang commented 2 years ago

Closing this as a duplicate of #143