PDF margins crop #1023
-
Hey! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's not easy, because there is no official PDF property to read this out. rect = fitz.Rect() # start empty
for b in page.get_text("blocks"):
rect |= b[:4] # join block rectangle into the total If you want to be overly diligent, also look for any drawings (these are not images!): for path in page.get_drawings():
rect |= path["rect"] |
Beta Was this translation helpful? Give feedback.
That's not easy, because there is no official PDF property to read this out.
You only can compute the maximum (union) rectangle for things on the page.
This computes the union of all text and images:
If you want to be overly diligent, also look for any drawings (these are not images!):