Page 1 of 1

Problems using trimbox on PDF's

Posted: 2009-08-20T00:01:17-07:00
by publit
Hello!

I'm using ImageMagick in combination with Ghostscript to read and interpret PDF-documents. At the moment I have a few PDF-files with these dimensions:

(These are the values given to me by InDesign/Photoshop/Acrobat Reader)

mediabox: 23.08 x 31.78 cm
cropbox: 23.08 x 31.78 cm
trimbox: 21 x 29.7 cm

I've successfully identified the size of the document with "identify", but that gives me the size of the mediabox (23.08x31.78 cm). What I'm trying to get now is the size of the trimbox. I've read up on this and I found that there's a function for this in ImageMagick, but I just can't get it to work. It always returns the mediabox-value.

Here's the code I'm running from the command line:
identify -format "%[fx:(w/72)*2.54]x%[fx:(h/72)*2.54]" -define pdf:use-trimbox=true foo.pdf

The -format is to get the dimensions in centimeters.

So the question is, is there anyone who have successfully used ImageMagick to get the size of the trimbox? And if so, I would really appreciate it if you could explain to me how this works.

Thanks!

Re: Problems using trimbox on PDF's

Posted: 2009-08-21T00:59:59-07:00
by publit
Someone? :(

Re: Problems using trimbox on PDF's

Posted: 2009-08-21T05:25:02-07:00
by anthony
IM doesn't actually deal with PDF files directly but asks Ghostscript to do so. The better idea may be to look at ghostscript utilities.

THe -define pdf:use-trimbox=true is used to set a command line option to ghostscript for PDF processing, that is all it really does.