Question

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).]

Was it helpful?

Solution

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.

OTHER TIPS

Write the following in your LaTeX document:

\setbox0 = \hbox{\includegraphics{small.pdf}}
width = \the\wd0, height = \the\ht0
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top