PHPackages                             daandd/laravel-dompdf - 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. daandd/laravel-dompdf

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

daandd/laravel-dompdf
=====================

A DOMPDF Wrapper for Laravel

v0.7.0(9y ago)026MITPHPPHP &gt;=5.5.9

Since Jun 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/DaanDD/laravel-dompdf)[ Packagist](https://packagist.org/packages/daandd/laravel-dompdf)[ RSS](/packages/daandd-laravel-dompdf/feed)WikiDiscussions master Synced 1mo ago

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

DOMPDF Wrapper for Laravel 5
----------------------------

[](#dompdf-wrapper-for-laravel-5)

### For Laravel 4.x, check the [0.4 branch](https://github.com/barryvdh/laravel-dompdf/tree/0.4)!

[](#for-laravel-4x-check-the-04-branch)

Require this package in your composer.json and update composer. This will download the package and the dompdf + fontlib libraries also.

```
composer require barryvdh/laravel-dompdf

```

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

[](#installation)

### Laravel 5.x:

[](#laravel-5x)

After updating composer, add the ServiceProvider to the providers array in config/app.php

```
Barryvdh\DomPDF\ServiceProvider::class,

```

You can optionally use the facade for shorter code. Add this to your facades:

```
'PDF' => Barryvdh\DomPDF\Facade::class,

```

### Lumen:

[](#lumen)

After updating composer add the following lines to register provider in `bootstrap/app.php`

```
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);

```

To change the configuration, copy the config file to your config folder and enable it in `bootstrap/app.php`:

```
$app->configure('dompdf');

```

Using
-----

[](#using)

You can create a new DOMPDF instance and load a HTML string, file or view name. You can save it to a file, or stream (show in browser) or download.

```
$pdf = App::make('dompdf.wrapper');
$pdf->loadHTML('Test');
return $pdf->stream();

```

Or use the facade:

```
$pdf = PDF::loadView('pdf.invoice', $data);
return $pdf->download('invoice.pdf');

```

You can chain the methods:

```
return PDF::loadFile(public_path().'/myfile.html')->save('/path-to/my_stored_file.pdf')->stream('download.pdf');

```

You can change the orientation and paper size, and hide or show errors (by default, errors are shown when debug is on)

```
PDF::loadHTML($html)->setPaper('a4', 'landscape')->setWarnings(false)->save('myfile.pdf')

```

If you need the output as a string, you can get the rendered PDF with the output() function, so you can save/output it yourself.

Use `php artisan vendor:publish` to create a config file located at `config/dompdf.php` which will allow you to define local configurations to change some settings (default paper etc). You can also use your ConfigProvider to set certain keys.

### Configuration

[](#configuration)

The defaults configuration settings are set in `config/dompdf.php`. Copy this file to your own config directory to modify the values. You can publish the config using this command:

```
php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"

```

You can still alter the dompdf options in your code before generating the pdf using this command:

```
PDF::setOptions(['dpi' => 150, 'defaultFont' => 'sans-serif']);

```

Available options and their defaults:

- **rootDir**: "{app\_directory}/vendor/dompdf/dompdf"
- **tempDir**: "/tmp" *(available in config/dompdf.php)*
- **fontDir**: "{app\_directory}/storage/fonts/" *(available in config/dompdf.php)*
- **fontCache**: "{app\_directory}/storage/fonts/" *(available in config/dompdf.php)*
- **chroot**: "{app\_directory}" *(available in config/dompdf.php)*
- **logOutputFile**: "/tmp/log.htm"
- **defaultMediaType**: "screen" *(available in config/dompdf.php)*
- **defaultPaperSize**: "a4" *(available in config/dompdf.php)*
- **defaultFont**: "serif" *(available in config/dompdf.php)*
- **dpi**: 96 *(available in config/dompdf.php)*
- **fontHeightRatio**: 1.1 *(available in config/dompdf.php)*
- **isPhpEnabled**: false *(available in config/dompdf.php)*
- **isRemoteEnabled**: true *(available in config/dompdf.php)*
- **isJavascriptEnabled**: true *(available in config/dompdf.php)*
- **isHtml5ParserEnabled**: false *(available in config/dompdf.php)*
- **isFontSubsettingEnabled**: false *(available in config/dompdf.php)*
- **debugPng**: false
- **debugKeepTemp**: false
- **debugCss**: false
- **debugLayout**: false
- **debugLayoutLines**: true
- **debugLayoutBlocks**: true
- **debugLayoutInline**: true
- **debugLayoutPaddingBox**: true
- **pdfBackend**: "CPDF" *(available in config/dompdf.php)*
- **pdflibLicense**: ""
- **adminUsername**: "user"
- **adminPassword**: "password"

### Tip: UTF-8 support

[](#tip-utf-8-support)

In your templates, set the UTF-8 Metatag:

```

```

### Tip: Page breaks

[](#tip-page-breaks)

You can use the CSS `page-break-before`/`page-break-after` properties to create a new page.

```

.page-break {
    page-break-after: always;
}

Page 1

Page 2

```

### License

[](#license)

This DOMPDF Wrapper for Laravel is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.4% 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 ~52 days

Recently: every ~108 days

Total

23

Last Release

3552d ago

PHP version history (3 changes)v0.1.0PHP &gt;=5.3.0

v0.5.0PHP &gt;=5.4.0

v0.7.0PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/0787ffc21b0ab2fc0e10b752e061db34b2403d9354a78cf490fe0a39cb04247f?d=identicon)[DaanDD](/maintainers/DaanDD)

---

Top Contributors

[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (70 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (3 commits)")[![zaherg](https://avatars.githubusercontent.com/u/27624?v=4)](https://github.com/zaherg "zaherg (2 commits)")[![itsgoingd](https://avatars.githubusercontent.com/u/821582?v=4)](https://github.com/itsgoingd "itsgoingd (1 commits)")[![juukie](https://avatars.githubusercontent.com/u/2678657?v=4)](https://github.com/juukie "juukie (1 commits)")[![Lednerb](https://avatars.githubusercontent.com/u/2056876?v=4)](https://github.com/Lednerb "Lednerb (1 commits)")[![perkola](https://avatars.githubusercontent.com/u/4265109?v=4)](https://github.com/perkola "perkola (1 commits)")[![russellgalpin](https://avatars.githubusercontent.com/u/1466187?v=4)](https://github.com/russellgalpin "russellgalpin (1 commits)")[![bebnev-studiotg](https://avatars.githubusercontent.com/u/96573854?v=4)](https://github.com/bebnev-studiotg "bebnev-studiotg (1 commits)")

---

Tags

laravelpdfdompdf

### Embed Badge

![Health badge](/badges/daandd-laravel-dompdf/health.svg)

```
[![Health](https://phpackages.com/badges/daandd-laravel-dompdf/health.svg)](https://phpackages.com/packages/daandd-laravel-dompdf)
```

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M274](/packages/barryvdh-laravel-dompdf)

PHPackages © 2026

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