Laravel Cloud
Generate PDFs on Laravel Cloud
How to generate professional PDFs on Laravel Cloud without installing Chrome or Puppeteer
The Challenge
Laravel Cloud is a powerful serverless platform that handles scaling, deployments, and infrastructure for you. But that convenience comes with a trade-off: you can't install system-level dependencies like Chrome or Puppeteer.
This means traditional PDF generation approaches that rely on headless browsers simply won't work. You're stuck with limited alternatives that can't handle modern CSS or Tailwind.
Why Current Solutions Fall Short
DomPDF
DomPDF is the go-to choice for many Laravel developers, but it has significant limitations:
- No Flexbox or Grid support - Modern layouts break completely
- Limited CSS support - Many properties are ignored or poorly rendered
- No Tailwind CSS - Utility classes won't work as expected
- Poor font handling - Custom fonts require manual setup and often fail
If your invoices or reports use any modern CSS, DomPDF will produce broken, ugly output.
wkhtmltopdf
Once a popular choice, wkhtmltopdf is now deprecated and unmaintained:
- Uses an outdated WebKit engine from 2012
- Security vulnerabilities that will never be patched
- Not available on Laravel Cloud anyway
- Poor CSS3 support
Self-hosted Puppeteer
Puppeteer with headless Chrome produces pixel-perfect PDFs, but:
- Not possible on Laravel Cloud - You can't install Chrome
- Even if you could, Chrome consumes 500MB+ of memory per instance
- Requires complex orchestration and worker processes
The TailPDF Solution
TailPDF is a PDF API built specifically for modern web applications. Instead of running Chrome on your server, you make an HTTP request and get a PDF back.
Why it works on Laravel Cloud:
- No dependencies to install - Just HTTP calls
- Perfect Tailwind CSS rendering - Every utility class works
- Sub-second generation - CSS asset caching makes it fast
- Scales automatically - We handle the Chrome instances
Quick Start
Install the TailPDF Laravel package via Composer:
composer require mralston/tailpdf
Add your API key to .env:
TAILPDF_API_KEY=your-api-key-here
Generate a PDF from your Blade view:
use Mralston\Tailpdf\Facades\TailPdf;
// Render a Blade view to PDF and download
return TailPdf::view('invoices.show', ['invoice' => $invoice])
->pdf()
->download('invoice.pdf');
Or stream directly to the browser:
use Mralston\Tailpdf\Facades\TailPdf;
// Stream PDF to browser
return TailPdf::view('invoices.show', ['invoice' => $invoice])
->pdf()
->stream();
Save to disk:
use Mralston\Tailpdf\Facades\TailPdf;
// Save PDF to storage
TailPdf::view('reports.monthly', ['data' => $data])
->pdf()
->save('reports/monthly.pdf');
What You Get
- Pixel-perfect output - Your PDFs look exactly like your web designs
- Full Tailwind support - All utility classes, including arbitrary values
- CSS Grid & Flexbox - Modern layouts just work
- Custom fonts - Google Fonts and web fonts supported
- Fast generation - Average 400ms response time
- Async jobs - Generate PDFs in the background for large batches
Stop fighting with PDF libraries. Start generating beautiful PDFs in minutes.
Ready to simplify PDF generation?
Start generating beautiful PDFs in minutes. No Chrome installation, no server configuration.
No credit card required • 100 free PDFs/month