Step1 : add following to your composer.json file
step2: update your composer using command.
composer update or php composer.phar update
step3: After update your composer. open app.php
path : config/app.php
Step4 : Add following line in ‘providers’
step5: Add following line in aliases
‘PDF’ => Barryvdh\DomPDF\Facade::class
step6 : suppose you want to use in your UserController then add following line above your class name.
step6: Suppose you want to print all user
Here is example
$user = User::all(); // from this you will get list of user and you ll render on view
return view(‘user.index’, compact(‘resetUrl’,’user’));
similarly, if you want to generate PDF then you do following
$pdf = PDF::loadView(‘user.index’, compact(‘user’));
//in view folder there is user folder inside that you have index file where you list all user
/—Below code generate your html view to PDF/
// user.pdf is named for example , you can write as per your need.