转换:Postscript委托失败 - 转换文本PDF

时间:2011-07-13 15:46:07

标签: pdf text imagemagick ghostscript

这个让我难过。

我需要将PDF转换为jpgs。我这样做是使用以下命令:

$cmd = "convert ".$upload->pdf_name." -geometry 80x80 -density 80x80 -quality 100 ".$upload->thumb_name." 2>&1";
exec($cmd,$results);

$cmd_gif = "convert ".$upload->pdf_name." -geometry 640x640 -density 640x640 -quality 100 ".$upload->gif_name." 2>&1";
exec($cmd_gif,$results);

如果我上传主要是图像的PDF,那么我没有问题。我得到缩略图和预览。 如果我上传一个主要是文本的PDF,并且我得到了print_r $ results:

Array([0] => convert: no decode delegate for this image format `/tmp/magick-wSgqd1Vp-00000001' @ error/constitute.c/ReadImage/532. 
[1] => convert: Postscript delegate failed `/var/www/vhosts/site/uploadedfiles/tmp/2_77.pdf': @ error/pdf.c/ReadPDFImage/664. 
[2] => convert: no decode delegate for this image format `/tmp/magick-8foOHRJR' @ error/constitute.c/ReadImage/532. 
[3] => convert: missing an image filename `/var/www/vhosts/site/uploadedfiles/tmp/2_77_thumb.jpg' @ error/convert.c/ConvertImageCommand/3015. 
[4] => convert: no decode delegate for this image format `/tmp/magick-M-zHuvtS-00000001' @ error/constitute.c/ReadImage/532. 
[5] => convert: Postscript delegate failed `/var/www/vhosts/site/uploadedfiles/tmp/2_77.pdf': @ error/pdf.c/ReadPDFImage/664. 
[6] => convert: no decode delegate for this image format `/tmp/magick-rJ8G814k' @ error/constitute.c/ReadImage/532. 
[7] => convert: missing an image filename `/var/www/vhosts/site/uploadedfiles/tmp/2_77.jpg' @ error/convert.c/ConvertImageCommand/3015. )

我安装了Ghostscript 8.70和imagemagick 6.7.1-0 我的linux发行版是CentOS 5.6版

1 个答案:

答案 0 :(得分:0)

你的第二个命令$cmd_gif要求ImageMagick创建一个640x640像素尺寸(“geometry”)的图片,同时要求分辨率(“密度“)640x640 ......