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

Method get_links

src/__init__.py:11790–11814  ·  view source on GitHub ↗

Create a list of all links contained in a PDF page. Notes: see PyMuPDF ducmentation for details.

(page: 'Page')

Source from the content-addressed store, hash-verified

11788 return utils.get_label_pno(page.number, labels)
11789
11790 def get_links(page: 'Page') -> list:
11791 """Create a list of all links contained in a PDF page.
11792
11793 Notes:
11794 see PyMuPDF ducmentation for details.
11795 """
11796
11797 CheckParent(page)
11798 ln = page.first_link
11799 links = []
11800 while ln:
11801 nl = utils.getLinkDict(ln, page.parent)
11802 links.append(nl)
11803 ln = ln.next
11804 if links != [] and page.parent.is_pdf:
11805 linkxrefs = [x for x in
11806 #page.annot_xrefs()
11807 JM_get_annot_xref_list2(page)
11808 if x[1] == mupdf.PDF_ANNOT_LINK # pylint: disable=no-member
11809 ]
11810 if len(linkxrefs) == len(links):
11811 for i in range(len(linkxrefs)):
11812 links[i]["xref"] = linkxrefs[i][0]
11813 links[i]["id"] = linkxrefs[i][2]
11814 return links
11815
11816 def get_pixmap(
11817 page: 'Page',

Callers 15

remove_rotationMethod · 0.95
linksMethod · 0.95
_do_linksMethod · 0.80
scrubMethod · 0.80
insert_htmlboxMethod · 0.80
do_linksFunction · 0.80
scrubFunction · 0.80
test_2886Function · 0.80
test_2922Function · 0.80
test_3301Function · 0.80
test_htmlbox1Function · 0.80

Calls 3

CheckParentFunction · 0.85
JM_get_annot_xref_list2Function · 0.85
appendMethod · 0.45

Tested by 9

test_2886Function · 0.64
test_2922Function · 0.64
test_3301Function · 0.64
test_htmlbox1Function · 0.64
test_3070Function · 0.64
test_2788Function · 0.64
test_3347Function · 0.64
test_3400Function · 0.64