PHP:Uncaught ImagickException:PDFDelegateFailed

问题描述 投票:1回答:2

我想用PHP生成pdf页面的图像。我正在使用imagick php扩展来实现这一点,但当我想通过imagick读取pdf文件时,我收到错误

Fatal error: Uncaught ImagickException: PDFDelegateFailed `The system cannot find the file specified. ' @ error/pdf.c/ReadPDFImage/801

我的代码是

$imagick = new Imagick();
$imagick->readImage(dirname(__FILE__). '/test.pdf'); 

我的服务器详细信息来自phpinfo()

PHP: Version 7.0.13
System: Windows NT LALMANI-PC 6.1 build 7601 (Windows 7 Ultimate Edition Service Pack 1) i586, Architecture: x86
imagick module version: 3.4.3
Imagick using ImageMagick library version: ImageMagick 6.9.3-7 Q16 x86

我还在我的系统中安装了ImageMagick-6.9.9-27和Ghostscript 9.22。

请告诉我这里有什么问题。提前致谢。

php pdf imagemagick ghostscript
2个回答
0
投票

ImageMagick找不到Ghostscript。最常见的原因是Ghostscript路径不在$ PATH环境变量中,因此IM不知道在哪里找到它。

添加Ghostscript安装路径(根据您的操作系统和您使用的软件包,如果它的Linux风格和您使用的软件包而有所不同)到PHP脚本运行时活动用户的$ PATH环境变量。


0
投票

我在64位的Ghostscript 9.22安装中遇到问题,我卸载并安装了Ghostscript 9.22 32位。问题已修复。

谢谢你的帮助。

© www.soinside.com 2019 - 2024. All rights reserved.