Replies: 4 comments
-
The coordinates are equal. |
Beta Was this translation helpful? Give feedback.
-
If i using So basically if i set CropBox = (64, 100, 500, 300) after when i try to get CropBox using diff lib then i'm getting diff CropBox values expected output:- current output:- |
Beta Was this translation helpful? Give feedback.
-
>>> import fitz
>>> doc=fitz.open()
>>> page=doc.new_page()
>>> page.rect
Rect(0.0, 0.0, 595.0, 842.0)
>>> page.cropbox
Rect(0.0, 0.0, 595.0, 842.0)
>>> page.set_cropbox((100,100,400,400))
>>> page.cropbox
Rect(100.0, 100.0, 400.0, 400.0)
>>> doc.xref_get_key(page.xref, "CropBox")
('array', '[100 442 400 742]')
>>> print(doc.xref_object(page.xref))
<<
/Type /Page
/MediaBox [ 0 0 595 842 ]
/Rotate 0
/Resources 3 0 R
/Parent 2 0 R
/CropBox [ 100 442 400 742 ] % <== this is what pypdf, etc return
>>
>>> page.rect
Rect(0.0, 0.0, 300.0, 300.0)
>>> |
Beta Was this translation helpful? Give feedback.
-
ok understood, but one question is why it's giving diff then which i used on set_cropbox function ? |
Beta Was this translation helpful? Give feedback.
-
I tried to crop the page using set_cropbox method and it's worked perfect. But the problem is when i tried to get cordinate from different library(pdfplumber, pypdf2) then i am getting different coordinate.
Reproduce Steps
configuration
Ubuntu 20.04
3.8.10
1.18.19
, installation method:-from source
.Beta Was this translation helpful? Give feedback.
All reactions