Easily generate PDF documents from HTML right inside of Laravel using this PDF wrapper. ZanySoft\LaravelPDF\PdfServiceProvider::class ] 'aliases' => [ //... 'PDF' => ZanySoft\LaravelPDF\Facades\PDF::class ] #configuration Configuration

use PDF; function generate_pdf() { $data = [ 'foo' => 'bar' ]; $pdf = PDF::::Make(); $pdf->loadView('pdf.document', $data); return $pdf->stream('document.pdf'); } or use ZanySoft\LaravelPDF\PDF; function generate_pdf() { $data = [ 'foo' => 'bar' ]; $pdf = new PDF(); $pdf->loadView('pdf.document', $data); return $pdf->stream('document.pdf'); }

$pdf->loadHTML($content); return $pdf->stream('document.pdf'); If you want to generate from files: $file = "file.txt" $pdf->loadFile($file); return $pdf->stream('document.pdf'); If you want download pdf file: return $pdf->embed('document.pdf'); If you want to save pdf to server: return $pdf->save('with-complete-path/document.pdf'); If you want add pdf file as attachment to email: return $pdf->embed('document.pdf'); #headers-and-footers Headers and Footers

use PDF; function generate_pdf() { $data = [ 'foo' => 'bar' ]; $pdf = PDF::Make(); $pdf->SetProtection(['copy', 'print'], 'user_pass', 'owner_pass') $pdf->loadView('pdf.document', $data); return $pdf->stream('document.pdf'); }
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners