Pdf Thumbnails

Hai,
Is there a way to create a thumb nail image of a pdf file which is uploaded by user using php?
Thanks in advance

Welcome to SP.

All the hits I found say to use Imagemagick. I never used it, but you can use imagemagick to convert pdf to an image. Probably some tweaking, you’ll get an image you are happy with. Look at: http://answers.google.com/answers/threadview?id=134543

Thank you very much.
that link is really usefull for me.

This is somewhat a tought one. ImageMagick will not work all the time.
If you really want a true thumbnail, meaning an image of how the pdf file looks like if you were to open it as pdf, then you actually need to open the file, take snapshot of the screen and then save that screen as an image. php cannot do this, but it can be done from php using couple of external programs.

The best thing to do is to use OpenOffice for opening the PDF file, then you may use ImageMagick to grab the contents of the screen and save it as an image.

This is not an easy thing to setup, but definitely can be done. The same setup can also be used to make thumbnails of just about any office document format such as MS Word doc, Excel, etc.

It can be done with Imagemagick:


exec("convert -density 300 input.pdf[0] -resize 200x200 output.jpg");

-density sets the input quality
[0] sets the page you want a thumbnail of in this case page 1
-resize is the maximium image size

There are other options you can add and there can be problems but you can find help on the Imagemagick forum.

You will need imagemagick installed as well as ghostscript.

Just give it a go and see.