Using Trimbox with ImageMagick

I have a PDF file with the following dimensions:

mediabox: 23.08 x 31.78 cm

crop: 23.08 x 31.78 cm

trim: 21 x 29.7 cm

I am 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.78cm which is the media / crop size. If I check the values ​​of these fields with Adobe Acrobat Reader, I get the values ​​I just posted at the top of this very post. Acrobat Reader / Photoshop / In Design tells me the trim is 21x29.7cm, but ImageMagick just doesn't read the same value.

My guess is that ImageMagick cannot interpret the trimbox correctly and then returns the field values.

Does anyone know how to get the trimbox value from a well-formed PDF or does anyone have the same problem?

Imagemagick states that this feature should work, but some of the forum threads are starting to discern.

+2


source to share


2 answers


convert -resize 50% -define pdf:use-cropbox=true 1.pdf 1.jpg

      



+3


source


You can always find it as pure text in the page dictionary:

alt text http://sourceforge.net/apps/wordpress/moonshiner/nfs/project/m/mo/moonshiner/uploads/2009/05/pdfboxdata.png



If you only need it in one case, a hex editor will probably suffice. If this is a repetitive thing that you want to do programmatically, you can use a PDF framework (a free example would be PoDoFo , but there are many others out there too).

0


source







All Articles