0
votes

I feel like I am missing something totally apparent, but either way here I am. I am using Snappy PDF to help generate a PDF of a commission pay stub for about 150 users through a foreach loop. It is my first time working with Snappy and I can't seem to get it to work at all. I keep getting this error:

RuntimeException in AbstractGenerator.php line 336: The exit status code '127' says something went wrong: stderr: "sh: 1: /vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64: not found " stdout: "" command: /vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality 'http://www.google.com' '/var/www/web/choicepartners/htdocs/storage/commissions/test.pdf'.

if (count($rows))
        {
            $pdf = App::make('snappy.pdf.wrapper');
            $pdf->generate('http://www.google.com', storage_path() . '/commissions/test.pdf');
        }

This is literally all of the code that implements Snappy. My directories are in the right place and I have triple checked the installation instructions from Github with no success.

Any smacks in the head to tell me what I'm missing would be a blessing!

1
Do you have wkhtmltopdf installed on your system?Vikas
Yes, I have wkhtmltopdf installed in directory /vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64.Drew
Can yoi show your config file? What's the binary path set in your config?Vikas
'binary' => '/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64',Drew
Change it to this: base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64')Vikas

1 Answers

0
votes

Do change in your config file

'binary' => '/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64',

to something like

base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),

then execute the following artisan commands

php artisan optimize:clear
php artisan config:cache
php artisan cache:clear
php artisan config:clear
php artisan config:cache