def resolve_goto_action(doc, a):
    """Resolves a "goto" action from the PDF outline into the associated page
    object and position on that page"""
    a = a.resolve()
    assert a['S'].name == 'GoTo'
    link = doc.get_dest(a['D']).resolve()['D']
    y = link[3] if link[1].name == 'XYZ' else 0
    return link[0], y