-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect handling of the link zoom parameter in link insertions #3349
Comments
File 'basic-link-1.pdf' contains a names dictionary (structure in the PDF catalog). Document-wide information like the names dictionary is not copied to the target PDF in method So the remaining issue is the incorrect handling of the zoom value. |
Thanks @JorjMcKie! |
You can walk through the named links of a page. Their dictionary items should contain all information you need to turn them into link0= {'kind': 4,
'xref': 24,
'from': Rect(56.69292068481445, 215.346435546875, 123.62651062011719, 225.346435546875),
'page': 1,
'to': Point(0.0, 813.54336),
'zoom': 0.0,
'nameddest': 'Link-01',
'id': ''} So you could define link1= {'kind': fitz.LINK_GOTO, 'from': link0["from"], link0["page"], 'to': link0["to"]}
page.delete_link(link0)
page.insert_link(link1) |
Description of the bug
When I merge two PDF files with reproducer code provided, I get
merged.pdf
files with some links not working anymore.To reproduce a bug, download
basic-link-1.pdf
andattachment-sample-1.pdf
files and run provided script in a directory that contain them. Open producedmerged.pdf
.Expected result:
Observed result:
Checked in Mac OS Preview and Chromium PDF viewers.
basic-link-1.pdf
attachment-sample-1.pdf
merged.pdf
How to reproduce the bug
PyMuPDF version
1.24.1
Operating system
MacOS
Python version
3.12
The text was updated successfully, but these errors were encountered: