Skip to content

BUG: text position detection works worse than in PyPDF2 #2200

@vors

Description

@vors

I'm trying to add a highlighting annotation to the doc using the text visitor to identify the coordinates to add it.

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
macOS-13.5.2-x86_64-i386-64bit

$ python -c "import pypdf;print(pypdf._debug_versions)"
pypdf==3.16.1, crypt_provider=('local_crypt_fallback', '0.0.0'), PIL=10.0.1

Code + PDF

This is a minimal, complete example that shows the issue:

repro repo https://github.com/vors/pypdf-highlighting-repro

Share here the PDF file(s) that cause the issue. The smaller they are, the
better. Let us know if we may add them to our tests!

You can add them to your tests.

Visuals

image

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