Closed ikseek closed 2 months ago
You did not provide a reproducer file. The referenced file seems to have all equal page heights.
Actually I did, the code generates pdf from scratch and page heights are different
Thanks for submitting this bug, and for the reproducing code. I've just pushed a fix so this will be fixed in our next release.
Fixed in 1.24.6.
Description of the bug
Having a document with pages of a different height I try to create a link from a rectangle on one page to a rectangle on another. When links are created to places on pages of equal heights, all works fine. When links are created to places on pages of different heights, viewers jump to an offset position on that page. Empirically I found that this offset is the difference of source and destination page heights.
Is that intended? In the example I'm attaching, I added a
convert
function, but why do I need it, shouldn't insert_link calculate it automatically?To reproduce the problem open the document with higher zoom level (300%) and click rectangles, notice that following links do not bring next rectangle into top-level corner of the viewport. Replace target point (to_rect.top_left) with commented out
convert
call to see workaround that fixes it. Tested in Mac OS Preview, Chrome PDF and https://mozilla.github.io/pdf.js/web/viewer.html viewers.How to reproduce the bug
PyMuPDF version
1.24.1
Operating system
MacOS
Python version
3.12