Skip to content

Page.get_drawings() return a Rect object with swapped x0, x1 #1234

Closed
@rednam-ntn

Description

@rednam-ntn

Describe

I have a PDF file.
When open with fitz, get page 0 and using Page.get_drawings() will return a result that have an item
('re', Rect(289.44879150390625, 149.60101318359375, 285.1968078613281, 153.85302734375))
with x0 and x1 had been swapped.

So, when I draw_rect() that item in another fitz.Document, blank page, new Rect will be drawn in wrong position at 289.44879150390625, 149.60101318359375, 289.44879150390625 + width, 149.60101318359375 + height

To Reproduce

I have written a short snippet with attached PDF file in this Google Colab Notebook

Please feel free to re-run it.

Expected behavior

the Page.get_drawings() method will return a Rect item in correct order of x0, x1
('re', Rect(285.1968078613281, 149.60101318359375, 289.44879150390625, 153.85302734375))

Screenshots

Screen Shot 2021-08-27 at 18 19 29

Your configuration (mandatory)

Test on:

  • My machine
    • macOS 11.5.2 (20G95)
    • Python 3.6.9
    • pip install PyMuPDF==1.18.17
  • Google Colab
    • Ubuntu 18.04.5
    • Python 3.7.11
    • pip install PyMuPDF==1.18.17

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions