Before generating PDFs, you should use Composer to install the Dompdf library.
composer require barryvdh/laravel-dompdf
Once you have installed the PDF SDK, configure the config/app.php file as follows:
'providers' => [ Barryvdh\DomPDF\ServiceProvider::class,
],
'aliases' => [ 'PDF' => Barryvdh\DomPDF\Facade::class, ]
As a final step, you can create a PDF file and return it as a download.
public function createPDF()
{
$name = "Ada Lovelace";
$my_pdf = Pdf::loadView('path.file_name', ['name'=>$name]);
return $my_pdf->download('my_pdf.pdf');
}