Laravel Calling Library facades directly
How do I call it without a library without "facades" on laravel 5
https://github.com/barryvdh/laravel-dompdf
PDF::loadHTML($html)->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save('myfile.pdf')
return PDF::loadFile(public_path().'/myfile.html')->save('/path-to/my_stored_file.pdf')->stream('download.pdf');
I have tried this unsuccessfully. Class not found.
$library = new \barryvdh\laraveldompdf\src\getDomPDF();
$pdf = $library->loadView('welcome', '');
return $pdf->download('invoice.pdf');
+3
source to share
1 answer
php is case sensitive, so you need to provide the namespace in all caps if set like this.
$lib = new \Barryvdh\DomPDF\PDF();
must work.
I'm not sure what you did in the first two lines of code you posted, but you need
use Barryvdh\DomPDF\PDF;
right after declaring the namespace in the file you want to use.
+5
source to share