0

I'm using draw_rect method of Pymupdf. It's not working on certain pages of the pdf. Following is the code for drawing rectangles. I tried the same rect values to plot on other pages and it plotted correctly.

doc = fitz.open(filepath )
x0,y0,x2,y2 = 39.13108444213867, 125.68994140625,  259.4792175292969, 149.265869140625
rect = fitz.Rect(x0-5,y0-5,x2+5,y2+5)
page = doc[9]
page.draw_rect(rect, color=[0,1,1,0], overlay=False,width=0.5,fill_opacity=1,fill=fill_color)

I also tried the below code before drawing. page._isWrapped gave False and after page.wrap_contets it became True. But still, I'm not able to plot the rectangle.

if not(page._isWrapped):
    page.wrap_contents()

Please help me to solve this issue.

Nayana Madhu
  • 1,185
  • 5
  • 17
  • 34

0 Answers0