jorisschellekens / borb

borb is a library for reading, creating and manipulating PDF files in python.
https://borbpdf.com/
Other
3.4k stars 147 forks source link

CropBox #178

Closed 6801318d8d closed 1 year ago

6801318d8d commented 1 year ago

I would like to remove the Crop Box from a PDF file, or change is size.

Can borb do that? Because I can't find anything in the examples.

jorisschellekens commented 1 year ago

borb represents a PDF as a JSON-like datastructure. You can easily do this kind of low-level operation by modifying the "PDF as JSON". In your particular case, look at doc['XRef']['Trailer']['Root']['Pages']['Kids'][0]['CropBox']

Also, in future please use StackOverflow to ask for help. Issues are meant for bugs and feature-requests.

Kind regards, Joris Schellekens