PHPackages                             daandekker/laravel-chrome-pdf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. daandekker/laravel-chrome-pdf

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

daandekker/laravel-chrome-pdf
=============================

Generate PDFs in Laravel using headless Chrome. Full CSS support, no Node.js required.

v1.0.0(5mo ago)03MITPHPPHP ^8.2CI passing

Since Jan 11Pushed 5mo agoCompare

[ Source](https://github.com/DaanDekker/laravel-chrome-pdf)[ Packagist](https://packagist.org/packages/daandekker/laravel-chrome-pdf)[ Docs](https://github.com/DaanDekker/laravel-chrome-pdf)[ RSS](/packages/daandekker-laravel-chrome-pdf/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

Laravel Chrome PDF
==================

[](#laravel-chrome-pdf)

Generate PDFs in Laravel using headless Chrome. Full CSS support including Tailwind CSS, Flexbox, Grid, and modern web features.

Features
--------

[](#features)

- Full CSS support (Flexbox, Grid, Tailwind v4)
- Real browser rendering engine
- System fonts + Google Fonts
- JavaScript support
- Headers &amp; footers with page numbers
- Queued PDF generation

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11.0+ or 12.0+
- Chrome/Chromium installed on the server

Installation
------------

[](#installation)

```
composer require daandekker/laravel-chrome-pdf
```

Optionally publish the configuration:

```
php artisan vendor:publish --tag=pdf-config
```

Configuration
-------------

[](#configuration)

Set the Chrome path in your `.env`:

```
PDF_CHROME_PATH=/usr/bin/chromium
PDF_TIMEOUT=60
PDF_STORAGE_DISK=local
PDF_STORAGE_PATH=pdfs
```

Common Chrome paths:

- **Linux:** `/usr/bin/chromium`, `/usr/bin/chromium-browser`, `/usr/bin/google-chrome`
- **macOS:** `/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`
- **Windows:** `C:\Program Files\Google\Chrome\Application\chrome.exe`
- **Docker (Alpine):** `/usr/bin/chromium-browser`

### Configuration File

[](#configuration-file)

```
// config/pdf.php
return [
    'chrome_path' => env('PDF_CHROME_PATH', '/usr/bin/chromium'),
    'timeout' => env('PDF_TIMEOUT', 60),
    'storage' => [
        'disk' => env('PDF_STORAGE_DISK', 'local'),
        'path' => env('PDF_STORAGE_PATH', 'pdfs'),
    ],
];
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use DaanDekker\ChromePdf\Facades\Pdf;

// From a Blade view
$pdf = Pdf::view('pdf.invoice', ['order' => $order]);

// From HTML string
$pdf = Pdf::html('Hello World');
```

### Output Methods

[](#output-methods)

```
// Download as attachment
return Pdf::view('pdf.invoice', $data)->download('invoice.pdf');

// Display inline in browser
return Pdf::view('pdf.invoice', $data)->stream('invoice.pdf');

// Save to file path
Pdf::view('pdf.invoice', $data)->save(storage_path('app/invoices/invoice.pdf'));

// Save to Laravel storage disk
Pdf::view('pdf.invoice', $data)->store('invoices/invoice.pdf', 's3');

// Get raw PDF content
$content = Pdf::view('pdf.invoice', $data)->output();
```

### Page Settings

[](#page-settings)

```
Pdf::view('pdf.invoice', $data)
    ->format('A4')              // A4, A3, Letter, Legal, Tabloid
    ->orientation('portrait')   // portrait, landscape
    ->landscape()               // Shorthand for landscape
    ->portrait()                // Shorthand for portrait
    ->margins(10, 10, 10, 10)   // top, right, bottom, left (mm)
    ->margin(15)                // Uniform margins (mm)
    ->scale(1.0)                // Scale factor (0.1 - 2.0)
    ->printBackground(true)     // Include CSS backgrounds
    ->download('invoice.pdf');
```

### Headers &amp; Footers

[](#headers--footers)

```
Pdf::view('pdf.invoice', $data)
    ->header('Company Name')
    ->footer('Page  of ')
    ->download('invoice.pdf');
```

Available footer/header variables: `pageNumber`, `totalPages`, `date`, `title`, `url`

### Wait for JavaScript

[](#wait-for-javascript)

```
// Wait for JS to complete (useful for charts/graphs)
Pdf::view('pdf.report', $data)
    ->waitFor(2000)  // milliseconds
    ->download('report.pdf');
```

Queued Generation
-----------------

[](#queued-generation)

For large PDFs or background processing:

```
use DaanDekker\ChromePdf\Jobs\GeneratePdf;

GeneratePdf::dispatch(
    view: 'pdf.invoice',
    data: ['order' => $order],
    path: "invoices/order-{$order->id}.pdf",
    disk: 's3'  // optional, defaults to config value
);
```

Styling Tips
------------

[](#styling-tips)

### Using Tailwind CSS

[](#using-tailwind-css)

Include Tailwind via CDN in your Blade template:

```
>

    Invoice

```

### Page Breaks

[](#page-breaks)

```

New Page

Keep together
```

### Print-Specific Styles

[](#print-specific-styles)

```
@media print {
    .no-print { display: none; }
    .print-only { display: block; }
}
```

API Reference
-------------

[](#api-reference)

### Pdf Facade Methods

[](#pdf-facade-methods)

MethodDescription`view(string $view, array $data = [])`Create PDF from Blade view`html(string $html)`Create PDF from HTML string### PdfBuilder Methods

[](#pdfbuilder-methods)

MethodDescription`format(string $format)`Set page format (A4, Letter, etc.)`orientation(string $orientation)`Set orientation (portrait/landscape)`landscape()`Set landscape orientation`portrait()`Set portrait orientation`margins(int $top, $right, $bottom, $left)`Set margins in mm`margin(int $margin)`Set uniform margins`scale(float $scale)`Set scale (0.1 - 2.0)`printBackground(bool $print = true)`Enable/disable CSS backgrounds`header(string $html)`Set header HTML`footer(string $html)`Set footer HTML`waitFor(int $ms)`Wait for JS (milliseconds)`save(string $path)`Save to file path`store(string $path, ?string $disk)`Save to storage disk`output()`Get PDF as string`download(string $filename)`Return download response`stream(string $filename)`Return inline responseLicense
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance70

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

174d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/60096029?v=4)[ Daan Dekker](/maintainers/DaanDekker)[@DaanDekker](https://github.com/DaanDekker)

---

Top Contributors

[![DaanDekker](https://avatars.githubusercontent.com/u/60096029?v=4)](https://github.com/DaanDekker "DaanDekker (9 commits)")

---

Tags

laravelpdfheadlesschrometailwind

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/daandekker-laravel-chrome-pdf/health.svg)

```
[![Health](https://phpackages.com/badges/daandekker-laravel-chrome-pdf/health.svg)](https://phpackages.com/packages/daandekker-laravel-chrome-pdf)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725173.2k14](/packages/tallstackui-tallstackui)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M146](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
