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

def getLinks(page):
    """Create a list of all links contained in a PDF page.
    
    Notes:
        see PyMuPDF ducmentation for details.
    """

    CheckParent(page)
    ln = page.firstLink
    links = []
    while ln:
        nl = getLinkDict(ln)
        if nl["kind"] == LINK_GOTO:
            if type(nl["to"]) is Point and nl["page"] >= 0:
                doc = page.parent
                target_page = doc[nl["page"]]
                ctm = target_page._getTransformation()
                point = nl["to"] * ctm
                nl["to"] = point
        links.append(nl)
        ln = ln.next
    if len(links) > 0:
        linkxrefs = page._getLinkXrefs()
        if len(linkxrefs) == len(links):
            for i in range(len(linkxrefs)):
                links[i]["xref"] = linkxrefs[i]
    return links