Click here to Skip to main content
15,890,982 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was trying to convert pdf to image.    
error : InvalidArgumentException No GS-Path set

My ImageMagick and ghostscript is working fine form cmd command line. So how i can set the gs path?


What I have tried:

Tried using spatie/pdf-to-image

$pdf = new PDF(public_path('approvedprocess-docs/working_files/5e94d32f99505.certificate.pdf'));
$pdf->saveImage(public_path('approvedprocess-docs/working_files/5e94d32f99505.certificate.jpg'));
Tried using org_heigl/ghostscript

    // Create the Ghostscript-Wrapper
    $gs = new Ghostscript ();
    // Set the output-device
    $gs->setDevice('jpeg')
    // Set the input file
       ->setInputFile(public_path('approvedprocess-docs/working_files/5e94d32f99505.certificate.pdf'))
    // Set the output file that will be created in the same directory as the input
       ->setOutputFile('output')
    // Set the resolution to 96 pixel per inch
       ->setResolution(96)
    // Set Text-antialiasing to the highest level
       ->setTextAntiAliasing(Ghostscript::ANTIALIASING_HIGH);
Both case getting error : InvalidArgumentException No GS-Path set
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900