I have this code:
<?php
require_once '../vendor/autoload.php';
require_once '../controller/funcoes.php';
require_once '../controller/constantes.php';
$pdf = new SpatiePdfToImagePdf('C:xampphtdocspdf_readerviewarquivo.pdf');
$n_pages = $pdf->getNumberOfPages();
for($i=0; $i < $n_pages; $i++){
$fileName = time();
$pdf->setPages($i)->saveImage($filename.".jpg");
}
echo "$i páginas criadas";
?>
I have the ImagickMagic and ghostscript(10.03.1) installed also, with the system variable path with this value: C:Program Filesgsgs10.03.1bin
When I run the script, it returns this error message:
Fatal error: Uncaught ImagickException: FailedToExecuteCommand `”gs”
-sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 “-sDEVICE=pngalpha” -dTextAlphaBits=4 -dGraphicsAlphaBits=4 “-r72x72”
-dPrinted=false “-sOutputFile=C:/Windows/TEMP/magick-f36-98eDD03_kdd4tvDDH1D1tWRY0Sfb%d”
“-fC:/Windows/TEMP/magick-cThxTwLomvy44ooiiQjsUW5SNzn02SKN”
“-fC:/Windows/TEMP/magick-Gpve-WcS4mc1A3mCM3_sJbPjzz7WRlIQ”‘ (O
sistema n�o pode encontrar o arquivo especificado. ) @
error/delegate.c/ExternalDelegateCommand/516 in
C:xampphtdocspdf_readervendorspatiepdf-to-imagesrcPdf.php:44
Stack trace: #0
C:xampphtdocspdf_readervendorspatiepdf-to-imagesrcPdf.php(44):
Imagick->readImage(‘C:\xampp\htdocs…’) #1 C:`your
text`xampphtdocspdf_readerviewlivro_features.php(5):
SpatiePdfToImagePdf->__construct(‘C:\xampp\htdocs…’) #2
{main} thrown in
C:xampphtdocspdf_readervendorspatiepdf-to-`imagesrcPdf.php
on line 44
I don´t understand whats is going on, since the file is in the path of the constructor method.
I someone can help, I appreciate very much
Roberto Carreira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.