views:

291

answers:

1

I have a PDF-file with the following dimensions;

mediabox: 23.08 x 31.78 cm

cropbox: 23.08 x 31.78 cm

trimbox: 21 x 29.7 cm

I'm using ImageMagick to try and get the trimbox value using Imagemagick's trimbox function.

identify -format "%[fx:(w/72)*2.54]x%[fx:(h/72)*2.54]" -define pdf:use-trimbox=true foo.pdf

This line of code gives me 23.08x31.78 cm which is the size of the media/crop-box. If I check the values of these boxes with Adobe Acrobat Reader I get the values I just posted in the top of this very post. Acrobat Reader/Photoshop/In Design tells me that the trimbox is 21x29.7 cm but ImageMagick just doesn't read the same value.

My guess is that ImageMagick can't interpret the trimbox correctly and then returns the cropbox values instead.

Does anyone know how to get the trimbox value from a correctly formated PDF-file or did anyone have the same problem?

Imagemagick states that this function should work, but some of the forums threads beg to differ.

A: 
balpha
I'm using ImageMagick combined with Ghostscript to read the dimensions of PDF-files, but I need the trimbox dimensions and not the mediabox dimensions. ImageMagick claim that their function can accomplish this, but I can't get it to work. I want to do this programatically with PHP. I'm gonna check PoDoFo out.
Stefan Konno
Hmm... I don't think there are PHP bindings for PoDoFo. Not sure, though.
balpha