@nizam0786 - My advice would be to generate a PDF of a view. I have used this package in the past and have no complaints : https://github.com/barryvdh/laravel-dompdf
...
use PDF;
...
public function downloadPdf(MyThing $myThing)
{
$data = $myThing->toArray()
// Return as a HTML page for debugging
// return view("simple-blade-template-with-header-and-footer", $data);
$pdf = PDF::loadView("simple-blade-template-with-header-and-footer", $data);
// Output PDF to view rather than downloading for debugging
// return $pdf->stream();
// Actually trigger a download
return $pdf->download("my-pdf.pdf");
}
If you want something more simple you can actually just use the @media print css media query. You can then get rid of some stuff in the view that's messing with the layout.
for example:
@media print
{
.print-hidden
{
display: none !important;
}
}