问题
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