PHP: Uncaught ImagickException: PDFDelegateFailed

与世无争的帅哥 提交于 2019-12-02 02:31:26

问题


I want to generate images from pdf pages in PHP. I am using imagick php extention to achieve this but I am getting error below when i am tring to read pdf file by imagick

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

My code is

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

My Server details from 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

I also installed ImageMagick-6.9.9-27 and Ghostscript 9.22 in my system.

Please let me know what is wrong here. Thanks in advance.


回答1:


I got issue in Ghostscript 9.22 installation that was 64-bit, I uninstalled that and installed Ghostscript 9.22 32-bit. Issue Fixed.

Thanks for your help.




回答2:


ImageMagick can't find Ghostscript. The most usual reason for this is that the Ghostscript path is not in the $PATH environment variable, so IM doesn't know where to find it.

Add the Ghostscript installation path (which will vary depending on your OS and the package you use if its a Linux flavour and you us a package) to the $PATH environment variable for the user whic is active when your PHP script runs.



来源:https://stackoverflow.com/questions/47969371/php-uncaught-imagickexception-pdfdelegatefailed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!