I have the following PDF document:
Which is generated printing an image with the default image viewer of Windows. And I try to draw a rectangle across the page border with this code:
from fitz import Documentdoc = fitz.Document('pixelated-image.pdf', filetype="pdf")page.draw_rect(page.rect, color=(0, 0, 1), width=2)doc.save('pixelated-image-with-bounded-page.pdf')doc.close()
But I get this file:
https://github.com/pymupdf/PyMuPDF/files/14822508/pixelated-image-with-bounded-page.pdf
Does someone know why the page.rect doesn't match with the real page size? I need to transform those dimensions somehow? Doing some tests, I've discovered that the real page dimension is more or less:
Rect(0, -279.95, 793.2, 841.4)
However, page.rect gives me the following dimension:
Rect(0.0, 0.0, 595.2757568359375, 841.8900146484375)
Thanks.