Create a list of all links contained in a PDF page. Notes: see PyMuPDF ducmentation for details.
(page: Page)
| 1000 | |
| 1001 | |
| 1002 | def get_links(page: Page) -> list: |
| 1003 | """Create a list of all links contained in a PDF page. |
| 1004 | |
| 1005 | Notes: |
| 1006 | see PyMuPDF ducmentation for details. |
| 1007 | """ |
| 1008 | |
| 1009 | CheckParent(page) |
| 1010 | ln = page.first_link |
| 1011 | links = [] |
| 1012 | while ln: |
| 1013 | nl = getLinkDict(ln) |
| 1014 | links.append(nl) |
| 1015 | ln = ln.next |
| 1016 | if links != [] and page.parent.is_pdf: |
| 1017 | linkxrefs = [x for x in page.annot_xrefs() if x[1] == PDF_ANNOT_LINK] |
| 1018 | if len(linkxrefs) == len(links): |
| 1019 | for i in range(len(linkxrefs)): |
| 1020 | links[i]["xref"] = linkxrefs[i][0] |
| 1021 | links[i]["id"] = linkxrefs[i][2] |
| 1022 | return links |
| 1023 | |
| 1024 | |
| 1025 | def get_toc( |
nothing calls this directly
no test coverage detected
searching dependent graphs…