views:

47

answers:

2

I have many hundreds of small PDF images (created in Adobe Illustrator) which will be inserted into a Latex document. I need to know the size of these images in real-world dimensions (e.g. 20mm x 14mm), or at least something that Latex can understand.

Is there a command line tool that can produce these dimensions? (I am running Mac OS X.)

A second best solution would some way for Latex to extract the dimensions.

[I have tried pdftk, but its data dump command only seems to tell me the number of pages (1).]

A: 

Write the following in your LaTeX document:

\setbox0 = \hbox{\includegraphics{small.pdf}}
width = \the\wd0, height = \the\ht0
Alexey Malistov
Thanks - this is fantastic.
Ross Duncan
A: 

Use pdfinfo or pdfinfo.exe (from the XPDF suite):

pdfinfo ^
   -f 1 ^
   -l 10 ^
   -box ^
   20-pages.pdf

This will extract all the page sizes and all the box info (MediaBox, CropBox, BleedBox, TrimBox, ArtBox) for pages 1 - 10 of the PDF.

pipitas
Exactly what I wanted - thank you.
Ross Duncan
@Ross Duncan: Can you upvote the answer then, please
pipitas
"Vote Up requires 15 reputation" Sorry!
Ross Duncan
oh, sorry, I didn't know...
pipitas