When I tried to get an pdf from the code below I got "Call to undefined method Knp\Snappy\Pdf::loadView()"
$data = [];
$pdf = PDF::loadView('test_view', $data);
return $pdf->download('test.pdf');
In my config/app.php I set the provider index 'Barryvdh\Snappy\ServiceProvider', and I also set the alias 'PDF' => 'Barryvdh\SnappyFacades\SnappyPdf'
I am working with Laravel 5.1
Did you import the class?
use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
Looks like you're IDE probably automatically imported Knp\Snappy\Pdf when you typed PDF::.
To use the facade that you've properly set up, just put $pdf = \PDF::loadView('test_view',$data);
Facades will resolve from \<facadeName>:: to the class listed in config/app.php automatically, removing the need for the line above that Chris suggested.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy.
If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.
Most helpful comment
Did you import the class?