-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FailedToExecuteCommand when trying to ping PDF file #217
Comments
I have same problem right now, did you find anything? |
Same problem here |
@afsakar @abrahampo1 Could you please report your PHP version, imagick version, OS, OS version, etc.? |
Same problem after mac os update to 14.4.1. Working with Herd, php 8.2, last version of pdf-to-image, gs 10.02.1 (2023-11-01) and ImageMagick 7.1.1-28 Q16-HDRI aarch64 b20675898:20240211 This is the exception: |
Versions: |
Took a while to work this one out - anyway for anyone who is using Herd and Mac this might help
this should as a whole look something like this in your controller / service:
Hope this helps |
Ok Thanks anyway
… On 5 Jun 2024, at 11:00, wallythewebdev ***@***.***> wrote:
Took a while to work this one out - anyway for anyone who is using Herd and Mac this might help
run from your command line the below code - this is going to tell you where you GS is installed.
which gs
make sure you have the package installed from Org_Heigl i.e.
use Org_Heigl\Ghostscript\Ghostscript;
in your code define the path to ghost script using the path that was returned form step 1
Ghostscript::setGsPath('/opt/homebrew/bin/gs');
this should as a whole look something like this in your controller / service:
<?php
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Artisan;
use Org_Heigl\Ghostscript\Ghostscript;
use Spatie\PdfToImage\Pdf;
use Imagick;
class PdfToImageConverter extends Controller
{
public function pdfToImage($path_to_image = null, $output_path = null)
{
Ghostscript::setGsPath('/opt/homebrew/bin/gs');
$pathToPdf = storage_path('pdf.pdf');
$pathToWhereImageShouldBeStored = storage_path('pdfImageFile.png');
$pdf = new Pdf($pathToPdf);
$pdf->saveImage($pathToWhereImageShouldBeStored);
}
}
Hope this helps
Quick note: not able to debug this further.
—
Reply to this email directly, view it on GitHub <#217 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BAIP7M6TXPFDZ67GBJ7A7V3ZF3HUJAVCNFSM6AAAAAA6X5F6MOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBZGI3DIMRYHE>.
You are receiving this because you commented.
|
@LucaMino @abrahampo1 @afsakar I've released v3.0 of the package - can you try upgrading and see if your issue is resolved? Thanks! 👍 |
Same problem. What about the others? have you the same problem? [2024-06-12 18:08:13] local.ERROR: ImagickException: FailedToExecuteCommand `'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r144x144' -dPrinted=false -dFirstPage=1 -dLastPage=1 '-sOutputFile=/var/tmp/magick-_a7_GMtGXVqvqLSTv4hqeZrahYp5zTke%d' '-f/var/tmp/magick-CKa3m3v0HT5O_kLCfFz446budgSohG1G' '-f/var/tmp/magick-eF-ZuBXMWN5d__1l0yDpU2GR766lQYjK'' (32512) @ error/ghostscript-private.h/ExecuteGhostscriptCommand/75 in /Users/usuario/IngMomDev/libro/vendor/spatie/pdf-to-image/src/Pdf.php:235 |
I've executed this cmd directly in the directory I have the file.pdf 'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r144x144' -dPrinted=false -dFirstPage=1 -dLastPage=1 '-sOutputFile=file.jpg' '-ffile.pdf' and worked without problem. Any ideas? |
In windows, You can replace the file name gswin64c.exe to gs.exe after changing the file name so it's working I have tried file name after convert that working. |
I had the same problem in my local Laravel Herd environment. It turned out that the ENV variable @juanborras If you are not able to extend the variable, you can use |
easiest way to solve this is to put this line in AppServerProvider::boot() putenv('PATH=' . getenv('PATH') . ':/opt/homebrew/bin'); |
I'm getting this error when I try to instantiate a class from the package.
Error
Versions
php: 8.1
gs: 10.02.0
imagick: 7.1.1
Thank you
The text was updated successfully, but these errors were encountered: