Reputation: 719
I've run my course with ImageMagick and Ghostscript. I left it alone to get on with other areas of development and for the entire day I've been trawling forums trying to get ImageMagick to work on my CentOS server and am now at a point where I could cry with frustration......
Is there a less flaky solution to simply convert an all text PDF into a jpg thumbnail so I can get this headache over and done with? Nobody seems to know what "Postscript Delegate Failed" means and I don't know how many times I'm meant to install, remove, reinstall, ./configure
, make
, make install
, tar
, feather, hang, draw and quarter Ghostscript and all the devel libraries... how difficult can it be to convert a PDF to a thumbnail?????
Help!! Please!!!!
Upvotes: 4
Views: 1573
Reputation: 719
Ok I found a solution. forget about trying to get ImageMagick to convert your PDFs. I've spent months on this and never found a solution.
So instead do this.
Use gs
directly to convert the PDF file to a jpeg.
exec("gs -sDEVICE=jpeg -o $tmp_image -dJPEGQ=95 $pdf_name 2>&1");
with the tmp_image in place you can then run the ImageMagick convert
app
exec("convert -colorspace RGB ".$tmp_image." -geometry 80x80 -quality 100 ".$thumb_image." 2>&1");
remembering to unlink($tmp_image);
to stop clutter. You should have your converted PDF
Upvotes: 1
Reputation: 13924
On CentOS?
/usr/bin/evince-thumbnailer --help
Usage:
evince-thumbnailer [OPTION...] <input> <ouput> - GNOME Document Thumbnailer
Help Options:
-h, --help Show help options
Application Options:
-s, --size=SIZE
It produces PNG's; easily converted. The -s SIZE
option seems to represent the minimum dimension, preserving aspect-ratio. (A US Letter sized file at -s 128
for me produced 128×166 px PNG.)
It's in the evince
package.
Upvotes: 1