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!
Problems using trimbox on PDF's
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Problems using trimbox on PDF's
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/