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

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

edusouza96/barryvdh-laravel-dompdf
==================================

A DOMPDF Wrapper for Laravel

1.0(1y ago)075MITPHPPHP &gt;8.0

Since Dec 10Pushed 1y agoCompare

[ Source](https://github.com/edusouza96/barryvdh-laravel-dompdf)[ Packagist](https://packagist.org/packages/edusouza96/barryvdh-laravel-dompdf)[ Fund](https://fruitcake.nl)[ GitHub Sponsors](https://github.com/barryvdh)[ RSS](/packages/edusouza96-barryvdh-laravel-dompdf/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

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

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

### Laravel wrapper for [Dompdf HTML to PDF Converter](https://github.com/dompdf/dompdf)

[](#laravel-wrapper-for-dompdf-html-to-pdf-converter)

[![Tests](https://github.com/barryvdh/laravel-dompdf/workflows/Tests/badge.svg)](https://github.com/barryvdh/laravel-dompdf/actions)[![Packagist License](https://camo.githubusercontent.com/e60623f508586f049d48cfb8396ee411b0c9bc3be174381a1893c37462a3c1e5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d626c7565)](http://choosealicense.com/licenses/mit/)[![Latest Stable Version](https://camo.githubusercontent.com/d49e2e2c63e31051d851acb9624ff8a762473fdec6248d851f6f28b3a9715395/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62617272797664682f6c61726176656c2d646f6d7064663f6c6162656c3d537461626c65)](https://packagist.org/packages/barryvdh/laravel-dompdf)[![Total Downloads](https://camo.githubusercontent.com/13e89dee4f27f4430dff1b3c7523d3e7baeb60bf30154a7ede04961c242f1952/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62617272797664682f6c61726176656c2d646f6d7064662e7376673f6c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/barryvdh/laravel-dompdf)[![Fruitcake](https://camo.githubusercontent.com/28d7584b52e33d7b4ffb6b1bef8b89b6e598adb45c8c0d5f80349c1c304f385e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f776572656425323042792d467275697463616b652d6232626333352e737667)](https://fruitcake.nl/)

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

[](#installation)

### Laravel

[](#laravel)

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

```

### 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.

```
    use Barryvdh\DomPDF\Facade\Pdf;

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

or use the App container:

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

Or use the facade:

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::setOption(['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**: false *(available in config/dompdf.php)*
- **isJavascriptEnabled**: true *(available in config/dompdf.php)*
- **isHtml5ParserEnabled**: true *(available in config/dompdf.php)*
- **allowedRemoteHosts**: null *(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"
- **artifactPathValidation**: null *(available in config/dompdf.php)*

#### Note: Since 3.x the remote access is disabled by default, to provide more security. Use with caution!

[](#note-since-3x-the-remote-access-is-disabled-by-default-to-provide-more-security-use-with-caution)

### 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

29

—

LowBetter than 63% of packages

Maintenance42

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.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

Unknown

Total

1

Last Release

466d ago

### Community

Maintainers

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

---

Top Contributors

[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (123 commits)")[![erikn69](https://avatars.githubusercontent.com/u/4933954?v=4)](https://github.com/erikn69 "erikn69 (17 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (3 commits)")[![sergiy-petrov](https://avatars.githubusercontent.com/u/8986207?v=4)](https://github.com/sergiy-petrov "sergiy-petrov (2 commits)")[![suryaprakashtiwari01](https://avatars.githubusercontent.com/u/9845920?v=4)](https://github.com/suryaprakashtiwari01 "suryaprakashtiwari01 (2 commits)")[![zaherg](https://avatars.githubusercontent.com/u/27624?v=4)](https://github.com/zaherg "zaherg (2 commits)")[![edusouza96](https://avatars.githubusercontent.com/u/14266630?v=4)](https://github.com/edusouza96 "edusouza96 (1 commits)")[![ericvanjohnson](https://avatars.githubusercontent.com/u/89408?v=4)](https://github.com/ericvanjohnson "ericvanjohnson (1 commits)")[![FrontEndCoffee](https://avatars.githubusercontent.com/u/16303480?v=4)](https://github.com/FrontEndCoffee "FrontEndCoffee (1 commits)")[![jdavidbakr](https://avatars.githubusercontent.com/u/25177?v=4)](https://github.com/jdavidbakr "jdavidbakr (1 commits)")[![jorisleermakers](https://avatars.githubusercontent.com/u/7288153?v=4)](https://github.com/jorisleermakers "jorisleermakers (1 commits)")[![juukie](https://avatars.githubusercontent.com/u/2678657?v=4)](https://github.com/juukie "juukie (1 commits)")[![ken717w](https://avatars.githubusercontent.com/u/6499363?v=4)](https://github.com/ken717w "ken717w (1 commits)")[![khaledelmahdi](https://avatars.githubusercontent.com/u/9323496?v=4)](https://github.com/khaledelmahdi "khaledelmahdi (1 commits)")[![koernchen02](https://avatars.githubusercontent.com/u/312900?v=4)](https://github.com/koernchen02 "koernchen02 (1 commits)")[![kyrylokulyhin](https://avatars.githubusercontent.com/u/8543282?v=4)](https://github.com/kyrylokulyhin "kyrylokulyhin (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![lucatrev](https://avatars.githubusercontent.com/u/77144?v=4)](https://github.com/lucatrev "lucatrev (1 commits)")[![maks-oleksyuk](https://avatars.githubusercontent.com/u/90793591?v=4)](https://github.com/maks-oleksyuk "maks-oleksyuk (1 commits)")[![Omranic](https://avatars.githubusercontent.com/u/406705?v=4)](https://github.com/Omranic "Omranic (1 commits)")

---

Tags

laravelpdfdompdf

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k84.4M229](/packages/barryvdh-laravel-dompdf)

PHPackages © 2026

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