Laravel — Create nice invoices with DomPDF (template!)

So you have to create a basic but good looking invoice design for your client (or yourself) in PDF format?

The invoice design I will provide in this article

Chances are that you’re using the laravel-dompdf package from Barryvdh, if so; good. Because this tutorial assumes you are using this package, I have not tried it with the original DomPDF wrapper though.

In my experience designing and giving a nice structural form to invoice templates has always been a pain in DomPDF, this is why I want to share this template with you.

Don’t worry there are no fancy tricks involved, just a plain template which you can adjust to your needs. Get it right here:

I always render the PDF’s from a method inside the Order.php model:

public function getPdf($type = 'stream')
$pdf = app('dompdf.wrapper')->loadView('order-pdf', ['order' => $this]);

if ($type == 'stream') {
return $pdf->stream('invoice.pdf');

if ($type == 'download') {
return $pdf->download('invoice.pdf');
return $order->getPdf(); // Returns stream default
return $order->getPdf('download'); // Returns the PDF as download

If you stream the PDF, it will render to your browser. If you download the PDF, as expected it will download the invoice.

I hope this article helped you getting started with a nice basic design for PDF invoice!

Note: please bare in mind that I am a Dutch developer, English is not my native language so this article could contain any grammatical errors.