How to Make Free Online Pdf Viewer using Php and Imagemagick for website


php_logoIf You are web developer and searching for making your own online pdf viewer for your project,Your search now ends here. Before going through tutorial,we first need to make our system/O.S. to meet requirements.For this you need to install Imagemagick . I have already posted regarding how to install imagemagick on ubuntu .After installing just copy and paste following code and save it as “test.php”.

readImage($file); $im1->resetIterator(); # Combine multiple images into one, stacked vertically. $ima = $im1->appendImages(true); $ima->setImageFormat("png"); //resize //$ima->setImageResolution(20,20); $ima->resampleImage (100,100,imagick::FILTER\_UNDEFINED,1); //$im1->cropThumbnailImage( 800, 800 ); //$ima->resizeImage(600,750, imagick::FILTER_LANCZOS, 1); $ima->setCompressionQuality(100); header("Content-Type: image/png"); echo $ima; ?>

Now Upload the “test.pdf” in the same folder where your test.php lies. Then browse test.php you must see in image format of your pdf.