GithubHelp home page GithubHelp logo

Comments (3)

JorjMcKie avatar JorjMcKie commented on June 10, 2024 1

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.

JorjMcKie avatar JorjMcKie commented on June 10, 2024

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.

ikseek avatar ikseek commented on June 10, 2024

Thanks @JorjMcKie!
Is there way to somehow convert this links manually via pymupdf?

from pymupdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.