Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16420

Page.rect isn't the real page dimension with PyMuPDF 1.24

$
0
0

I have the following PDF document:

pixelated-image.pdf

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.


Viewing all articles
Browse latest Browse all 16420

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>