Problems using trimbox on PDF's
Posted: 2009-08-20T00:01:17-07:00
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!
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!