You need to download and install wkhtmltopdf exe file
http://wkhtmltopdf.org/downloads.html#stable
then use laravel wrapper
Add the following line in the required
http://wkhtmltopdf.org/downloads.html#stable
then use laravel wrapper
Add the following line in the required
"barryvdh/laravel-snappy": "0.2.*"
After updating composer, add the ServiceProvider to the providers array in app/config/app.phpBarryvdh\Snappy\ServiceProvider::class,
You can optionally use the facade for shorter code. Add this to your facades:'PDF' => Barryvdh\Snappy\Facades\SnappyPdf::class, 'SnappyImage' => Barryvdh\Snappy\Facades\SnappyImage::class,
Using the wrapper:$pdf = App::make('snappy.pdf.wrapper'); $pdf->loadHTML('<h1>Test</h1>'); return $pdf->inline();
Or use the facade:$pdf = PDF::loadView('pdf.invoice', $data); return $pdf->download('invoice.pdf');
Important : You can publish the config-file to change some settings (default paper etc).php artisan vendor:publish
No comments:
Post a Comment