PHPackages                             breuer/laravel-make-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. breuer/laravel-make-pdf

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

breuer/laravel-make-pdf
=======================

Convert HTML to PDF using a headless Chrome instance

v0.3.0(1mo ago)71.1k↓26.9%2MITPHPPHP ^8.2CI passing

Since Oct 3Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/jellebreuer/laravel-make-pdf)[ Packagist](https://packagist.org/packages/breuer/laravel-make-pdf)[ Docs](https://github.com/jellebreuer/laravel-make-pdf)[ RSS](/packages/breuer-laravel-make-pdf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (31)Versions (16)Used By (0)

Convert HTML to PDF with headless Chrome
========================================

[](#convert-html-to-pdf-with-headless-chrome)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c36643cfe1c16bd87367af10f5555193a87ac3df8dad33602cfa99f9e2ed660e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6272657565722f6c61726176656c2d6d616b652d7064662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/breuer/laravel-make-pdf)[![Total Downloads](https://camo.githubusercontent.com/0c811ecb7f950acce187ed0fc75c8cf0d58e8ff7bd43b275065c463a0bdb4cdc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6272657565722f6c61726176656c2d6d616b652d7064662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/breuer/laravel-make-pdf)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2fab7e04ac630216d28db3601e0df81ec8a4c544093d8be1f963d990c67f6fec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a656c6c656272657565722f6c61726176656c2d6d616b652d7064662f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jellebreuer/laravel-make-pdf/actions/workflows/run-tests.yml)[![GitHub PHPStan Action Status](https://camo.githubusercontent.com/9b1502c7453f25b499a42a5644566438732162749f9c1f8bad9312b4bfc26c3a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a656c6c656272657565722f6c61726176656c2d6d616b652d7064662f7068707374616e2e796d6c3f6272616e63683d6d6173746572266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/jellebreuer/laravel-make-pdf/actions/workflows/phpstan.yml)[![GitHub Pint Action Status](https://camo.githubusercontent.com/f5e77f1188bc9f82f8d211736dd7ccd42f20337ecdbe13fb210aa9567fa6ddcb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a656c6c656272657565722f6c61726176656c2d6d616b652d7064662f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d6c61726176656c25323070696e74267374796c653d666c61742d737175617265)](https://github.com/jellebreuer/laravel-make-pdf/actions/workflows/fix-php-code-style-issues.yml)

This package allows you to easily convert HTML to PDF using headless Chrome through Selenium, without needing Node.js. It is inspired by Spatie's [laravel-pdf](https://github.com/spatie/laravel-pdf) package, which uses BrowserShot and Puppeteer, but our solution offers a more PHP-centric approach using Selenium.

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

[](#requirements)

Laravel Make PDF requires **PHP 8.2+** and **Laravel 11+**.

Installation &amp; Setup
------------------------

[](#installation--setup)

You can install the package via Composer:

```
composer require breuer/laravel-make-pdf
```

After installation, download headless Chrome using the following Artisan command:

```
php artisan make-pdf:install
```

To customize the package configuration, publish the configuration file:

```
php artisan vendor:publish --tag="laravel-make-pdf-config"
```

Here is the content of the published config file:

```
return [
    // Configuration options will go here
];
```

Usage
-----

[](#usage)

Converting HTML to PDF with this package is simple and efficient. Below are a few common use cases:

### Basic Example

[](#basic-example)

Convert a Blade view to a PDF and stream it to the browser:

```
use Breuer\MakePDF\Facades\PDF;

Route::get('/', function () {
    return PDF::view('view.name', [])->response();
});
```

Or force the browser to download the PDF file

```
return PDF::view('view.name', [])->download();
```

### Options

[](#options)

#### Render Raw HTML:

[](#render-raw-html)

Instead of passing a Blade view, you can directly pass HTML:

```
PDF::html('Hello World')
```

#### Header and Footer

[](#header-and-footer)

You can include a view in the header and footer of every page:

```
PDF::view('view.name', [])
    ->headerView('view.header')
    ->footerView('view.footer')
    ->response();
```

Alternatively, set raw HTML for the header and footer:

```
->headerHtml('My header')
->footerHtml('My footer')
```

In the header or footer, the following placeholders can be used and will be replaced with their print-specific values:

```

```

**Note:** The header and footer do not inherit the same CSS as the main content, and the default font size is 0. You should include any required CSS directly in the header/footer. Here’s an example of a styled footer view:

```

    footer {
        font-size: 13px;
        color: black;
    }

     /

```

#### Landscape Orientation

[](#landscape-orientation)

Switch the page orientation to landscape:

```
use Breuer\MakePDF\Enums\Orientation;

PDF::landscape()
```

#### Set Paper Format

[](#set-paper-format)

Specify a standard paper format:

```
use Breuer\MakePDF\Enums\Format;

PDF::format(Format::A4)
```

The following formats are available: `LETTER`, `LEGAL`, `A0`, `A1`, `A2`, `A3`, `A4`, `A5`, `A6`.

#### Set Custom Paper Size

[](#set-custom-paper-size)

Set a custom paper size, specifying height and width in inches (or another unit):

```
use Breuer\MakePDF\Enums\Unit;

PDF::paperSize($height, $width)  // Uses inches by default
PDF::paperSize(29.7, 21, Unit::CENTIMETER)  // Uses centimeters and converts to inches
```

#### Set Margins

[](#set-margins)

Set custom margins for the PDF document:

```
use Breuer\MakePDF\Enums\Unit;

PDF::margins($top, $right, $bottom, $left) // Uses inches by default
PDF::margins(2.54, 1.27, 2.54, 1.27, Unit::CENTIMETER)  // Centimeters, converted to inches
```

#### Custom Filename

[](#custom-filename)

Define a custom name for the PDF when downloading from the browser. The `.pdf` extension is automatically appended if omitted:

```
PDF::view('view.name', [])
    ->name('custom_filename')
    ->response();
```

#### Save to File

[](#save-to-file)

Use the `save` method to store the PDF at a given file path:

```
->save('/path/to/save/yourfile.pdf')
```

#### Retrieve PDF as a String

[](#retrieve-pdf-as-a-string)

To obtain the raw PDF content as a string, use the `raw` method:

```
$content = PDF::view('view.name', [])->raw();
```

#### Stream PDF

[](#stream-pdf)

Display the PDF directly in the browser without saving it to disk:

```
->response()
```

#### Force Download

[](#force-download)

Prompt the browser to immediately download the PDF:

```
->download()
```

License
-------

[](#license)

This package is open-sourced software licensed under the MIT License. Please see the [License File](LICENSE.md) for more information.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance90

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.1% 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

Every ~41 days

Recently: every ~30 days

Total

14

Last Release

53d ago

PHP version history (2 changes)v0.0.1PHP ^8.1

v0.3.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/a51e35ceda259801c99a9cb5466cece7f4d793b5bf2525c7d4d4050c7f296672?d=identicon)[breuer](/maintainers/breuer)

---

Top Contributors

[![jellebreuer](https://avatars.githubusercontent.com/u/5371337?v=4)](https://github.com/jellebreuer "jellebreuer (95 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (47 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (43 commits)")[![sofyan-1999](https://avatars.githubusercontent.com/u/83222432?v=4)](https://github.com/sofyan-1999 "sofyan-1999 (1 commits)")

---

Tags

laravelBreuerlaravel-make-pdf

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/breuer-laravel-make-pdf/health.svg)

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

9963.4M12](/packages/spatie-laravel-pdf)[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[spatie/laravel-mailcoach-sdk

An SDK to easily work with the Mailcoach API in Laravel apps

41290.2k1](/packages/spatie-laravel-mailcoach-sdk)

PHPackages © 2026

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