pdfinfo
is one of the utility programs bundled with xpdf that gives useful information about PDF files, including its size. However, the size is written in Postscript points, and I can't say I'm that fluent in this unit to actually know how big that is. So here is a shell function that converts the output of pdfinfo into centimeters. Enjoy !
pdfinfom () { pdfinfo "$@" | perl -p -e \ 's#(\d+)\s*x\s*(\d+)\s*pts#(sprintf "%.2f", ($1*2.54/72))." x ".(sprintf "%.2f", ($2*2.54/72))." cm"#e' }
2 comments:
Hi!
I adapted the function to optionally accept decimal dimensions (e.g. 725.7 x 1091.4 pts) that my system uses. (Ubuntu 12.10, pdfinfo v0.20.4 from package poppler-utils).
Take care
pdfinfom () { pdfinfo "$@" | perl -p -e 's#(\d+\.*\d*)\s*x\s*(\d+\.*\d*)\s*pts#(sprintf "%.2f", ($1*2.54/72))." x ".(sprintf "%.2f", ($2*2.54/72))." cm"#e'; };
Hi!
I twiked your nice function to optionally accept decimal dimensions (e.g. 725.7 x 1091.4 pts), as found on my system. (Ubuntu 12.10, pdfinfo 0.20.4 from package poppler-utils ).
Take care
pdfinfom () { pdfinfo "$@" | perl -p -e 's#(\d+\.*\d*)\s*x\s*(\d+\.*\d*)\s*pts#(sprintf "%.2f", ($1*2.54/72))." x ".(sprintf "%.2f", ($2*2.54/72))." cm"#e'; };
Post a Comment