You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
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
The text was updated successfully, but these errors were encountered:
Thanks for submitting this. I will have a look.
In the meantime, you can fix this via executing rect.normalize() I think (will confirm this in testing). This makes sure the rectangle is finite.
Also please note to incorporate a few changes in shape.finish() - necessary since v1.18.17:
shape.finish(
fill=path["fill"], # fill colorcolor=path["color"], # line colordashes=path["dashes"], # line dashingeven_odd=path.get("even_odd", True), # control color of overlapsclosePath=path["closePath"], # whether to connect last and first pointlineJoin=path["lineJoin"], # how line joins should look likelineCap=max(path["lineCap"]), # how line ends should look likewidth=path["width"], # line widthstroke_opacity=path.get("stroke_opacity", 1), # key may not always be presentfill_opacity=path.get("fill_opacity", 1), # key may not be present
)
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 at289.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
Your configuration (mandatory)
Test on:
pip install PyMuPDF==1.18.17
pip install PyMuPDF==1.18.17
The text was updated successfully, but these errors were encountered: