Repository navigation
page.rect does not match with the real page size #3324
Unanswered
jmgomezsoriano
asked this question in
Q&A
Replies: 1 comment 5 replies
|
You did not supply your example PDF, so I have to assume a few things. In [4]: print(doc.xref_object(page.xref))
<<
/Type /Page
/Annots [ 10 0 R ]
/Parent 4 0 R
/Rotate 0
/Contents 11 0 R
/MediaBox [ 0 0 595.32 841.92 ] # <===
/Resources <<
/Font <<
/R8 12 0 R
/R10 13 0 R
/R12 14 0 R
/R14 15 0 R
/R17 16 0 R
/R20 17 0 R
/R23 18 0 R
/R27 19 0 R
>>
/ProcSet [ /PDF /Text ]
/ExtGState <<
/R7 20 0 R
>>
>>
>>This does not prevent the PDF creator to put things on the page that (partly) go beyond this area. You simply have to accept that and adjust your code accordingly if needed. Method |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
I've made this code:
But it draws a rectangle smaller than the real page size and not centered in the fist of the page. The page.rect gives me:
Rect(0.0, 0.0, 595.2757568359375, 841.8900146484375)
And trying what is the best rectangle to matches with the page I'll found more or less this:
Rect(0, -279.95, 793.2, 841.4)
Does anyone know the reason of this discrepancy? In other PDF documents it matches, but it doesn't with a PDF which only have a scanned image.
Thanks.
All reactions