First install the FPDF package
$ composer require codedge/laravel-fpdf
Creating a PDF from your Controller:
<?php
namespace App\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Codedge\Fpdf\Fpdf\Fpdf;
class PDFController extends Controller
{
private $fpdf;
public function __construct()
{
}
public function createPDF()
{
$this->fpdf = new Fpdf;
$this->fpdf->AddPage("L", ['100', '100']);
$this->fpdf->Text(10, 10, "Hello FPDF");
$this->fpdf->Output();
exit;
}
}