Create Thumbnails of PDF files in PHP, Java, Perl, or Ruby?

James

New member
It is possible in PHP, although you were right, you need a few libraries.

ImageMagic:
http://us3.php.net/imagick

Ghostscript:
http://sourceforge.net/projects/ghostscript/

Then, this code will get your thumbnail:

<?php
$im = new imagick('file.pdf[0]');
$im->setImageFormat( "jpg" );
header( "Content-Type: image/jpeg" );
echo $im;
?>

Haven't tried it myself, but seems like it would work
 
It is possible in PHP, although you were right, you need a few libraries.

ImageMagic:
http://us3.php.net/imagick

Ghostscript:
http://sourceforge.net/projects/ghostscript/

Then, this code will get your thumbnail:

<?php
$im = new imagick('file.pdf[0]');
$im->setImageFormat( "jpg" );
header( "Content-Type: image/jpeg" );
echo $im;
?>

Haven't tried it myself, but seems like it would work
 
Hey guys I have a massive collection of PDF files for my company and most of them are proposals and what not. I'm building an intranet system and I would like to create a library of all these PDF files but I would also like to display a Thumbnail of the first few pages of each file.

Is there any library in any of these languages that I may be able to utilize to add to my project that can create those thumbnails?
I've tried the code:
<?php
$im = new imagick('file.pdf[0]');
$im->setImageFormat( "jpg" );
header( "Content-Type: image/jpeg" );
echo $im;
?>

works fine but the file name is part of an array and won't work with me replacing the file.pdf[0] with the array addres: $pdf[1]
 
Back
Top