Mar
16

Preview PDF in PHP

PHP          Trackback

If you want to create preview image of some pdf you have on your site, all you need is web server that has installed Imagick. If you are lucky enough to have that you can use this code:

<?
$preview = new imagick('somepdf.pdf[0]'); /* read first page of PDF */
setImageFormat('jpeg'); /* set preview format to jpeg */
header('Content-Type: image/jpeg'); /* display preview */
echo $preview;
?>


No Comments

Make A Comment

No comments yet.

Comments RSS Feed    TrackBack URL

Leave a comment

top