I am on Win Server 2012 IIS 8, PHP 5.6, Imagick Module 3.1.2, ImageMagick 6.8.7-2 2013-10-18 Q16.
I have read through all the Postscript delegate failed errors and have done the following: - Installed GhostScript - Checked that GS and Imagick is in the PATH var - Checked that I can use convert in the command prompt (Does work) - PHP exec("whoami") returns nt authority\iusr which I added for Full Control - I tried using full paths backslashes () double-backslashes (\) foward-slashes (/) - I don't think it has anything to do with the path because if I try the same code on a jpg with no path it works. Script and files are in the same path.
Here is my PHP code:
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
echo exec("whoami"); echo "<br/>";
echo exec("convert.exe dr.pdf dr.jpg 2>&1"); // Does not work and gives below error
echo "<br/>";
$im = new imagick();
$im->readimage("dr.pdf");
$pages = $im->getNumberImages();
echo $pages;
?>
Output:
nt authority\iusr convert.exe: no images defined `dr.jpg' @ error/convert.c/ConvertImageCommand/3145.
Fatal error: Uncaught exception 'ImagickException' with message 'Postscript delegate failed `dr.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/682' in D:\WWW\DEMO\data\temp\test.php:13 Stack trace: #0 D:\WWW\DEMO\data\temp\test.php(13): Imagick->readimage('dr.pdf') #1 {main} thrown in D:\WWW\DEMO\data\temp\test.php on line 13
Any help would be greatly appreciated. Regards Johan