Skip to content

Problem with coordinate inversion when origin is not bottom left #1332

Description

@vincentmasse

Describe the bug

It is possible to have pdf where the origin is not bottom left. For example, I have a pdf with centred origin. The raw mediabox is (-100, -200, 100, 200) and the resulting bbox in pdfplumber is (-100, 200, 100, 600).

Expected behaviour

Following pdfplumber convention (origin at top left), bbox should be (0, 0, 200, 400), with all the content in the right system.

Actual behaviour

If we have raw bounding box

  • x0_r=-100
  • y0_r=-200
  • x1_r=100
  • y1_r=200

We get that the page bbox is

  • x0 = x0_r = -100
  • y0 = -y0_r = 200
  • x1 = x1_r = 100
  • y1 = (y1_r - y0_r) - y0_r = 600

Screenshots

Image

Environment

  • pdfplumber version: 0.11.5
  • Python version: 3.11.13
  • OS: Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions