Generating a PDF in Laravel means choosing which problem you want to own. dompdf makes you write CSS like it's 2011. Snappy chains you to an abandoned binary. Browsershot renders beautifully and quietly turns your PHP server into a Node and Chrome host.

There is a fourth option: render your Blade view exactly as you would for the browser, POST the HTML to an API and get back a real vector PDF. This article covers why the three usual suspects hurt, and what the API route looks like in practice.

Where dompdf falls over

dompdf is a pure PHP renderer, which is exactly why people reach for it: composer require and you are generating PDFs with no binaries and no system dependencies. The cost is the rendering engine. dompdf implements CSS 2.1 with a partial layer of CSS3, and that ceiling shapes everything you build on it.

No flexbox. No grid. Floats behave, mostly, which is why every dompdf invoice template on the internet is built from floats and tables. Web fonts need registering with the font loader rather than just working. And because there is no JavaScript engine, anything your view computes client-side simply never happens.