title: Fatal error: Uncaught ImagickException: PDFDelegateFailed
body: <p>I want to display PDF files like image files on my WebPage on Apache2.4 on PHP7 in Windows 2008 Server, but I'm having the next error: </p>
  
  <p>Fatal error: Uncaught ImagickException: PDFDelegateFailed</p>
  
  <p>I already have installet ImageMagick-7.0.8-Q16 and Ghostscript 9.27 (32 bits) I replace Ghostcript 9.27 - 64 bits because the Apache Server shutdown inmediatly and restart. Here I found this note here: <a href="https://stackoverflow.com/questions/47969371/php-uncaught-imagickexception-pdfdelegatefailed">PHP: Uncaught ImagickException: PDFDelegateFailed</a> .</p>
  
  <p>On Command Line window:</p>
  
  <p>If I run magick file.pdf file.jpg it's work.</p>
  
  <p>If I run magick -verbose file.pdf file.jpg it's work and i see that it's using gswin32c.exe.</p>
  
  <p>I have the same WebPage on my computer with Win10 Pro, same Imagick version, same ghostscript version, same Apache version, same PHP version and it's working fine.</p>
  
  <pre><code>$pdfInfo = new Spatie\PdfToImage\Pdf($file);
  while ($page &lt; $pdfInfo-&gt;getNumberOfPages()) {
    $imagick = new Imagick();
    $imagick-&gt;setResolution(100, 100);
    $imagick-&gt;readImage(sprintf('%s[%s]', $file, $page));
    echo sprintf('&lt;img src="data:image/%s;base64,%s" &gt;&lt;br&gt;', $type, base64_encode($imagick));
    $page++;
  </code></pre>