Wim
Wim

Reputation: 547

How to crop a PDF using the TrimBox data

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?

Upvotes: 3

Views: 3680

Answers (2)

Wim
Wim

Reputation: 547

Found the answer on AcrobatUsers.com: http://answers.acrobatusers.com/How-I-crop-PDF-TrimBox-data-q33436.aspx . Try67 gave me the following:

This script will set the crop box of each page in a document to be the same as the trim box. You can use it in an Action to apply it to multiple files:

 for (var p=0; p<this.numPages; p++)
 {
      this.setPageBoxes("Crop", p, p,
      this.getPageBox("Trim", p));
 }

which had the result that I needed.

Thank you to user Joost to remind me that I hadn't closed the thread yet.

Upvotes: 1

joost
joost

Reputation: 6659

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

Upvotes: 1

Related Questions