Closed rashidabbas7865 closed 4 years ago
Same error.
Here is my work around to fix this issue and it perfectly worked!
use Spatie\PdfToImage\Pdf;
use Org_Heigl\Ghostscript\Ghostscript;
and
Ghostscript::setGsPath("C:\Program Files\gs\gs9.52\bin\gswin64c.exe");
$pdf_url = 'C:\Program Files\public\pdf\file.pdf';
$pdf = new Pdf($pdf_url);
$pdf->setOutputFormat('png')->saveImage('rashid%d');
Make sure you have installed imagemagick and ghostscript. And the pdf url must be directory based url. not domain url. Please try this solution. It will surely work. This Video is exactly what I suggested. Please follow it
@rashidabbas7865 can you please help me to fix this issue? I tried it but request in my browser takes too long and nothing happens.
Here is my code... $form = public_path('car_ij_appfrm.pdf'); $pdf = new Pdf($form);
$gs_path = public_path('gs\gs952w64.exe');
Ghostscript::setGsPath($gs_path);
foreach (range(1, $pdf->getNumberOfPages()) as $pageNumber) {
$file_name = public_path('page'.$pageNumber.'jpg');
$pdf->setPage($pageNumber)->saveImage($file_name);
}
Have you tried with my way?? Were you able to make it work?
@rashidabbas7865 yes tried your way as well. But its not working due to GS. can you give me few minutes for this ? its a request.
Send me your details.
Skype: khurram.shahzad358 khurramshahzadkhan11@gmail.com
Skype: khurram.shahzad358 khurramshahzadkhan11@gmail.com
This Video is exactly what I suggested. Please follow it
Hi, I'm facing this issue with normal use
$pdf = new Pdf(asset('pdf/file.pdf')); $pdf->saveImage(asset('pdf'));
I'm using windows and Xampp. I have installed imagemagick and ghostscript on my windows. What it is the issue now. Please help me. where I set the path.