MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / resolve_link

Method resolve_link

src/__init__.py:6187–6211  ·  view source on GitHub ↗

Calculate internal link destination. Args: uri: (str) some Link.uri chapters: (bool) whether to use (chapter, page) format Returns: (page_id, x, y) where x, y are point coordinates on the page. page_id is either page number (if chapter

(self, uri=None, chapters=0)

Source from the content-addressed store, hash-verified

6185 mupdf.pdf_check_document(pdf)
6186
6187 def resolve_link(self, uri=None, chapters=0):
6188 """Calculate internal link destination.
6189
6190 Args:
6191 uri: (str) some Link.uri
6192 chapters: (bool) whether to use (chapter, page) format
6193 Returns:
6194 (page_id, x, y) where x, y are point coordinates on the page.
6195 page_id is either page number (if chapters=0), or (chapter, pno).
6196 """
6197 if not uri:
6198 if chapters:
6199 return (-1, -1), 0, 0
6200 return -1, 0, 0
6201 try:
6202 loc, xp, yp = mupdf.fz_resolve_link(self.this, uri)
6203 except Exception:
6204 if g_exceptions_verbose: exception_info()
6205 if chapters:
6206 return (-1, -1), 0, 0
6207 return -1, 0, 0
6208 if chapters:
6209 return (loc.chapter, loc.page), xp, yp
6210 pno = mupdf.fz_page_number_from_location(self.this, loc)
6211 return pno, xp, yp
6212
6213 def rewrite_images(
6214 self,

Callers 3

recurseMethod · 0.80
destMethod · 0.80
recurseFunction · 0.80

Calls 1

exception_infoFunction · 0.85

Tested by

no test coverage detected