-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question / Comment: How to crop white margins around the page #617
Comments
Sure. You can set the CropBox property. This attribute's diemsnions initially equal that of the (unrotated) page. |
What is Can you give some example |
An object of class
72 pixels equal one inch, so you can calculate in this unit and respectivel centimeters. You can algebraically add / subtract rectangles: So the shortest form to omit that border in this example is executing |
thank you very much. For an elaborate answer |
We're looking at dropping |
Yes, It does not physically delete the part becoming invisible. Other values for that rectangle may recover these things. To compute the smallest rectangle for anything the page has to show use rect = fitz.EMPTY_RECT() # start with the standard empty rectangle
for item in page.get_bboxlog():
rect |= item[1] # join this bbox into the result
# rect now wraps all page content The advantage is, that no text or image or whatever needs to be extracted to do this. An item of |
Thanks @JorjMcKie we'll check this out. :-) |
I generally have a need to crop the white margins on few sides and some times all sides
I am using pdf-crop-margins to crop the margin in the bottom only using the following commad
Can something similar can be done using pymupdf
The text was updated successfully, but these errors were encountered: