Posts tagged with pdf

Laravel PDF v2 has been released: adds support for Laravel Cloud and easy queuing original

by Freek Van der Herten – 6 minute read

A while ago, we released laravel-pdf, a package to generate PDFs in Laravel apps.

Under the hood, it used Browsershot (and therefore Puppeteer/Chrome) to convert HTML to PDF. That approach works great, but it does require Node.js and a headless Chrome binary on your server.

Last week, my buddy Dries shared on X how to generate PDFs using Cloudflare services. This way doesn’t require Node or any binaries. Very neat! This unlocks PDF generation for environments where Node or Chrome cannot be installed easily, like Laravel Cloud.

To support this way of rendering a PDF, we’ve released a new major release (v2) of Laravel PDF. The package now ships with three drivers: Browsershot, Cloudflare Browser Rendering, and DOMPDF. You can also create your own driver. On top of that, we've added queued PDF generation and the ability to set PDF metadata. And to let your AI understand our package, we've added a Laravel Boost skill.

Let me walk you through all of it.

Read more

Join 9,500+ smart developers

Every month I share what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.

No spam. Unsubscribe anytime. You can also follow me on X.

Creating beautiful invoices using Tailwind and Laravel PDF original

by Freek Van der Herten – 2 minute read

Last week, we released a new package called Laravel PDF that allows you to transform Blade views into PDFs. Under the hood, Chromium is used to perform the transformation. Because Chromium is an up-to-date browser, you can use any modern CSS you like.

Some people have asked if they can use Tailwind to style their documents. And I’m happy to report you can. Let’s take a look at a minimal example to showcase this.

Read more

Easily create PDFs in Laravel apps original

by Freek Van der Herten – 6 minute read

We’ve released a new package called spatie/laravel-pdf, a batteries-included package to generate PDFs in Laravel apps. Under the hood, it uses Chromium to generate PDFs from Blade views. You can use modern CSS features like grid, flexbox, and even frameworks like Tailwind to create beautiful PDFs.

In this post, I’d like to introduce and demonstrate the package.

Read more

Fixing Imagick's “not authorized” exception

alexvanderbist.com

The last couple of weeks soem strange Imagick errors popped up across all our servers. In a new blogpost my colleague Alex explains the cause and the fix.

Over the last few days we've had a couple of issues with Imagick and processing PDFs on our servers. As it turns out, these issues are caused by automatic security updates. Let's look into the issue and its solution.

Read more [alexvanderbist.com]

A package to extract text from a pdf original

by Freek Van der Herten – 1 minute read

For a project I needed to extract some text from a pdf. Although there were already a few packages that could to this, I still created spatie/pdf-to-text because I wanted something that was really easy to use. And also because it's fun creating packages. Under the hood a utility called pdftotext is…

Read more

Convert a pdf to an image using PHP original

by Freek Van der Herten – 1 minute read

Converting a pdf to an image is easy using PHP, but the API kinda sucks. $imagick = new Imagick('file.pdf[0]'); $imagick->setImageFormat('jpg'); file_put_contents($pathToImage, $imagick); The pdf-to-image-package aims to fix that. Here is the equivalent code: $pdf = new…

Read more