If you just want width and height, use
<?php $pdffile = "filename.pdf"; $pdfinfo = shell_exec("pdfinfo ".$pdffile); // find height and width preg_match('/Page size:\s+([0-9]{0,5}\.?[0-9]{0,3}) x ([0-9]{0,5}\.?[0-9]{0,3})/', $pdfinfo,$heightandwidth); $width = $heightandwidth[1]; $height = $heightandwidth[2]; ?>
This will give you height and width with glasses. Then you can do some simple math to convert it to whatever units you are looking for.
source share