pranaysharmadelhi Posted November 24, 2008 Share Posted November 24, 2008 Hi, I am working on a project which requires the following: User uploads a pdf file(through basic php form) pdf is stored temporarily and the Width/Height of the pdf is checked against a matrix in database and a price is calculated and the user is sent to shopping cart for printing. I have tried fpdi with FPDF and TCPDF but both of them require me to enter a value for a new PDF and then import an existing PDF. ??? I am having hard time finding out how to find out widht/height of the imported pdf and also how many pages exists. Any help would be greatly appreciated. Thanks! Link to comment https://forums.phpfreaks.com/topic/134081-find-out-width-and-height-of-a-given-pdf-file/ Share on other sites More sharing options...
jwilliam Posted November 24, 2008 Share Posted November 24, 2008 This is the way I do it, but you'll need to be on a linux server with Image Magick installed: $command = escapeshellcmd('identify -format "%wx%h" ' . $path_to_pdf) . '[0]'; $geometry = `$command`; list($width, $height) = split("x", $geometry); Then you can access the dimensions through $width and $height. Link to comment https://forums.phpfreaks.com/topic/134081-find-out-width-and-height-of-a-given-pdf-file/#findComment-697972 Share on other sites More sharing options...
Mchl Posted November 24, 2008 Share Posted November 24, 2008 Correct if I'm wrong, but every page in PDF file can have different dimensions, so you will need to get all of them. Link to comment https://forums.phpfreaks.com/topic/134081-find-out-width-and-height-of-a-given-pdf-file/#findComment-697983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.