Skip to content

y-coordinates are "top to bottom" for words but "bottom to top" for line points. #1369

@SimonAndreys

Description

@SimonAndreys

Describe the bug

y-coordinates are "top to bottom" for words but "bottom to top" for line points.

Minimal Working Example

Attached pdf shows a vertical line with "a" at the top and "b" at the bottom.

lignes.pdf

Attached code prints the coordinates of "a" and "b" and of x0, y0, x1, y1 of the only line in the pdf.

plumbTest.py

Expected behavior

The coordinates of "a" should be within 10 points of the coordinates of x1,y1 (or x0,y0).

Actual behavior

The y-coordinate of "a" do not match with y1 (nor y0). Instead it is close to page.height-y1, which correspond to a change from top-to-bottom direction to bottom-to-top.
'''
a coordinates:
x0=71.04614, y0=127.08910000000003, x1=73.33113999999999, y1=132.08910000000003
line :
x0=73.33114, y0=710.980737, x1=73.33114, y1=767.67365
line (reverted y):
x0=73.33114, y0=130.90906300000006, x1=73.33114, y1=74.21615000000008
'''

Environment

  • pdfplumber Version: 0.11.9
  • Python 3.12.3
  • OS : linux

###Remark
fixing this might be a breaking change for some applications...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions