Comments (3)
You can walk through the named links of a page. Their dictionary items should contain all information you need to turn them into LINK_GOTO
items. That one named items is
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)
from pymupdf.
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 .insert_pdf()
because this is a page-based method.
Named links in the source dictionary can thus not be copied - there is no internal link-kind-conversion like LINK_NAMED ==> LINK_GOTO.
So "Linking to an ID" is bound to fail.
So the remaining issue is the incorrect handling of the zoom value.
I therefore are taking the liberty to change the issue title accordingly.
from pymupdf.
Thanks @JorjMcKie!
Is there way to somehow convert this links manually via pymupdf?
from pymupdf.
Related Issues (20)
- subset_fonts error exit without exception/warning HOT 6
- insert_pdf gives TypeError HOT 4
- insert_pdf gives SystemError HOT 6
- Embedded full-text search index HOT 4
- Page.delete_widget() doesn't fully remove the widget, other programs still detect the widgets HOT 14
- regression: fill_textbox: IndexError: pop from empty list HOT 5
- Unable to create a checked radiobutton HOT 1
- draw_rect scaled to very small size HOT 5
- set_toc method error HOT 8
- Marked content sequences in text trace dictionary HOT 3
- 1.24.2/1.24.3: spurious characters introduced when using subset_fonts and insert_pdf HOT 7
- PyMuPDF 1.24.4 causes "segmentation fault" under Python 3.12 and old MAC OS HOT 12
- pixmap.invert_irect(pixmap.irect) take 7 seconds HOT 3
- cygwin x64 pip3 install pymupdf error HOT 2
- When extracting a numbered list, the result is not as expected. HOT 3
- Small size after apply fitz.TOOLS.set_small_glyph_heights(True) HOT 2
- page.get_label() gets wrong label on the first page of doc
- doc.saveIncr() error and doc.close error HOT 2
- Text Color Change for different fonts HOT 1
- get_toc(simple=False) AttributeError: 'Outline' object has no attribute 'rect' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymupdf.