Skip to content

Bug: incomplete link extraction #42

@kevinhu

Description

@kevinhu

I'm using pdftext to extract links from a PDF, but I'm encountering issues where the anchor text is cut off.

For example, I've been using this PDF from the latest Anthropic funding attachment, which I've linked below. After running dictionary_output, links such as "Claude 3.7 Sonnet" appear to only have a URL attached to the last word in the link rather than the entire span.

If you open the PDF, you can confirm that the entire text is linked rather than only the last word.

{
    "bbox": [
        304.00433349609375,
        733.3996200561523,
        343.6524658203125,
        745.5496215820312
    ],
    "text": "Claude",
    "rotation": 0.0,
    "font": {
        "name": "DAAAAA+TiemposText-Regular",
        "flags": 524292,
        "size": 18.0,
        "weight": 724
    },
    "char_start_idx": 750,
    "char_end_idx": 755,
    "url": ""
},
{
    "bbox": [
        346.7061767578125,
        742.655029296875,
        346.7061767578125,
        742.655029296875
    ],
    "text": " ",
    "rotation": 0.0,
    "font": {
        "name": "",
        "flags": 0,
        "size": 1.0,
        "weight": -1
    },
    "char_start_idx": 756,
    "char_end_idx": 756,
    "url": ""
},
{
    "bbox": [
        346.251220703125,
        733.3996200561523,
        361.2065124511719,
        745.5496215820312
    ],
    "text": "3.7",
    "rotation": 0.0,
    "font": {
        "name": "DAAAAA+TiemposText-Regular",
        "flags": 524292,
        "size": 18.0,
        "weight": 724
    },
    "char_start_idx": 757,
    "char_end_idx": 759,
    "url": ""
},
{
    "bbox": [
        364.1081237792969,
        742.655029296875,
        364.1081237792969,
        742.655029296875
    ],
    "text": " ",
    "rotation": 0.0,
    "font": {
        "name": "",
        "flags": 0,
        "size": 1.0,
        "weight": -1
    },
    "char_start_idx": 760,
    "char_end_idx": 760,
    "url": ""
},
{
    "bbox": [
        363.8052978515625,
        733.3996200561523,
        403.8422546386719,
        745.5496215820312
    ],
    "text": "Sonnet",
    "rotation": 0.0,
    "font": {
        "name": "DAAAAA+TiemposText-Regular",
        "flags": 524292,
        "size": 18.0,
        "weight": 724
    },
    "char_start_idx": 761,
    "char_end_idx": 766,
    "url": "https://www.anthropic.com/news/claude-3-7-sonnet"
}

anthropic.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions