Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For scripting I need to get the page dimensions of a PDF file (in mm).

pdfinfo just prints it in 'pts', e.g.:

Page size:      624 x 312 pts

What should I use?

Or what unit is 'pts' anyway - in case I want to convert them ...

share|improve this question
2  
Point on Wikipedia –  Mat May 27 '12 at 18:16
    
Which page did you want the size of? The legal size outer cover? The leaflet size "this page is intentionally blank"? The letter size double pages? –  Ignacio Vazquez-Abrams May 28 '12 at 9:53
add comment

2 Answers

Not the easiest way, but given imagemagick and units you could also use

$ identify -verbose some.pdf | grep "Print size" 
Print size: 8.26389x11.6944

to find the page size in inches (this may yield several results if the PDF uses different dimensions) and then convert the numbers like this:

$ units -t '8.26389 inch' 'mm'
  209.90281

Meaning that 8.26 inches are 209.9 mm (I used an A4 PDF for this).

share|improve this answer
add comment
up vote 7 down vote accepted

The 'pts' unit used by pdfinfo denotes a PostScript point. A PostScript point is defined in terms of an inch and a resolution of 72 dots per inch:

In the late 1980s to the 1990s, the traditional point was supplanted by the desktop publishing point (also called the PostScript point), which was defined as 72 points to the inch (1 point = 1⁄72 inches = 25.4⁄72 mm = 0.352¯7 mm [ ≙ 0.3528 mm] ).

The manual to gv contains a list of common paper formats specified in PostScript points.

share|improve this answer
    
on common paper formats: pdfinfo sometimes gives me the paper format (like Page size: 595.28 x 841.89 pts (A4)) — I wonder if it does that for a list of page sizes it knows about? –  njsg May 27 '12 at 20:45
2  
A point is actually 0.352777777... mm, so 0.3528 mm is a closer approximation. –  cjm May 28 '12 at 5:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.