Problems using trimbox on PDF's

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
publit

Problems using trimbox on PDF's

Post 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!
publit

Re: Problems using trimbox on PDF's

Post by publit »

Someone? :(
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problems using trimbox on PDF's

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply