Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to crop a PDF using the TrimBox data

Tags:

pdf

crop

I have a large PDF file and I use Adobe Acrobat X Pro. The document comes straight from the publisher, so it has its TrimBox and BleedBox defined. The catch is that the cropping dimensions differ from page to page.

Is it possible within Adobe Acrobat X Pro to define a batch operation so that all the pages will be cropped automagically to the correct size (as is defined with the TrimBox settings per page)? I understand how to define a CropBox, but if I use those settings on the whole document (or even a folder filled with documents), all pages will be cropped with the same, fixed dimensions (which is not what we need).

I also found a useful Question that can help me solve this problem using ImageMagick and GhostScript (link), but I noticed that that resulted in some data loss, making the images too "smudgy" for my purpose. If there is a way to do this with ImageMagick without data loss, that would be fine too, but I prefer using the Batch operation of Adobe Acrobat X Pro if that would be possible.

Any ideas?

like image 716
Wim Avatar asked Dec 19 '25 15:12

Wim


1 Answers

You should try ImageMagick with the -density option. So something like:

convert -verbose -define pdf:use-trimbox=true -density 300x300 your_pdf.pdf output.format

The density option should make sure it does not get blurry, see: http://www.imagemagick.org/script/command-line-options.php#density

like image 76
joost Avatar answered Dec 21 '25 21:12

joost



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!