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

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

laravel-enso/pdf
================

PDF for Laravel Enso

2.1.4(2mo ago)138.8k↓39.4%2MITPHPPHP &gt;=7.4CI failing

Since Jul 15Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/laravel-enso/pdf)[ Packagist](https://packagist.org/packages/laravel-enso/pdf)[ Docs](https://github.com/laravel-enso/pdf)[ RSS](/packages/laravel-enso-pdf/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (17)Used By (0)

PDF
===

[](#pdf)

[![License](https://camo.githubusercontent.com/91f3abce4e66c09fbde9355e5eb0b5738251892ba35b896b79a77f3acef69b20/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f7064662f6c6963656e7365)](LICENSE)[![Stable](https://camo.githubusercontent.com/283176bdd38617677a19a7b1d662fe2f9c3d7eef96965a44fb16cdb2df4a22be/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f7064662f76657273696f6e)](https://packagist.org/packages/laravel-enso/pdf)[![Downloads](https://camo.githubusercontent.com/8e546793ca35c23b171a5f9a2d86b865d45c754a5f1fb897e9a353e56f7a52ee/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f7064662f646f776e6c6f616473)](https://packagist.org/packages/laravel-enso/pdf)[![PHP](https://camo.githubusercontent.com/30c907835ccbb7c3e0ecd4af460efb8b2dcef7fe59e21ea7ecdfa6839a0b5d51/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e342532422d3737376262342e737667)](composer.json)[![Issues](https://camo.githubusercontent.com/18e3919f300ec7de54b85024a334058c329034e47b2bf9d4f0bae5063832b6af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c61726176656c2d656e736f2f7064662e737667)](https://github.com/laravel-enso/pdf/issues)[![Merge Requests](https://camo.githubusercontent.com/90b40276708fcfac677595d40595e8d52f3a78e046cae3e48c7cf93810bfb7af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6c61726176656c2d656e736f2f7064662e737667)](https://github.com/laravel-enso/pdf/pulls)

Description
-----------

[](#description)

Pdf provides a small Laravel Enso wrapper around Snappy / wkhtmltopdf for generating PDF documents from Blade views.

The package exposes a fluent `Pdf` service that applies Enso's default page settings, loads a view with data, and then lets the caller inline, download, save, or output the rendered PDF.

It is used across the ecosystem for invoices, orders, delivery notes, stock documents, and other printable documents that need a consistent PDF pipeline.

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

[](#installation)

Install the package:

```
composer require laravel-enso/pdf
```

The package relies on `barryvdh/laravel-snappy`, which in turn requires a working `wkhtmltopdf` binary in the target environment.

No additional provider registration is needed beyond Composer's package discovery.

Features
--------

[](#features)

- Wraps `barryvdh/laravel-snappy` in a small fluent service.
- Loads Blade views with arbitrary data before rendering.
- Streams PDFs inline in the browser.
- Supports file download responses.
- Supports saving generated PDFs to disk.
- Exposes raw PDF output as a string.
- Ships with Enso defaults for paper size, margins, orientation, and footer pagination.

Usage
-----

[](#usage)

Generate a PDF from a Blade view:

```
use LaravelEnso\Pdf\Services\Pdf;

return (new Pdf())
    ->loadView('documents.order', ['order' => $order])
    ->inline('order.pdf');
```

Download instead of inlining:

```
return (new Pdf())
    ->loadView('documents.invoice', ['invoice' => $invoice])
    ->download('invoice.pdf');
```

Save the generated file:

```
(new Pdf())
    ->loadView('documents.note', ['model' => $model])
    ->save(storage_path('app/temp/document.pdf'));
```

Switch to landscape and override options when needed:

```
$pdf = (new Pdf())
    ->landscape()
    ->setOption('margin-top', 5)
    ->loadView('documents.report', ['report' => $report]);
```

::: warning Note This package is only a wrapper around Snappy. Rendering still depends on the availability and correctness of the underlying `wkhtmltopdf` binary in the running environment. :::

API
---

[](#api)

### Contracts

[](#contracts)

- `LaravelEnso\Pdf\Contracts\GeneratesPdf`
- `LaravelEnso\Pdf\Contracts\SavesPdf`

`GeneratesPdf` defines:

- `inline(): Response`
- `output(): string`

`SavesPdf` defines:

- `save()`

### Pdf Service

[](#pdf-service)

`LaravelEnso\Pdf\Services\Pdf`

Public methods:

- `__construct()`
- `inline(string $filename = 'document.pdf'): Response`
- `output(): string`
- `save($filename, $overwrite = false): PdfWrapper`
- `download(string $filename): Response`
- `landscape(): self`
- `setOption(string $option, $value): self`
- `loadView(string $view, array $attributes): self`

Default options applied in the factory:

- `paper: a4`
- `orientation: portrait`
- `margin-top: 10`
- `margin-left: 5`
- `margin-right: 5`
- `margin-bottom: 10`
- `footer-font-size: 8`
- `footer-center: "Page [page] from [toPage]"`

Depends On
----------

[](#depends-on)

Framework dependency:

- [`laravel/framework`](https://github.com/laravel/framework) [↗](https://github.com/laravel/framework)

External dependencies:

- [`barryvdh/laravel-snappy`](https://github.com/barryvdh/laravel-snappy) [↗](https://github.com/barryvdh/laravel-snappy)
- [`wkhtmltopdf`](https://wkhtmltopdf.org/) [↗](https://wkhtmltopdf.org/)

Contributions
-------------

[](#contributions)

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance85

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~176 days

Recently: every ~376 days

Total

15

Last Release

75d ago

Major Versions

1.1.1 → 2.0.02020-06-25

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16073274?v=4)[Adrian Ocneanu](/maintainers/aocneanu)[@aocneanu](https://github.com/aocneanu)

---

Top Contributors

[![aocneanu](https://avatars.githubusercontent.com/u/16073274?v=4)](https://github.com/aocneanu "aocneanu (10 commits)")[![gandesc](https://avatars.githubusercontent.com/u/14071925?v=4)](https://github.com/gandesc "gandesc (9 commits)")[![DevIonut](https://avatars.githubusercontent.com/u/19207797?v=4)](https://github.com/DevIonut "DevIonut (4 commits)")[![GITmanuela](https://avatars.githubusercontent.com/u/44998004?v=4)](https://github.com/GITmanuela "GITmanuela (3 commits)")[![raftx24](https://avatars.githubusercontent.com/u/10864136?v=4)](https://github.com/raftx24 "raftx24 (1 commits)")

---

Tags

ensohelperlaravelpackagepdflaravelpdflaravel-enso

### Embed Badge

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

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

###  Alternatives

[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[initred/laravel-tabula

laravel-tabula is a tool for liberating data tables trapped inside PDF files for the Laravel framework.

1418.6k](/packages/initred-laravel-tabula)[nilgems/laravel-textract

A Laravel package to extract text from files like DOC, XL, Image, Pdf and more. I've developed this package by inspiring "npm textract".

195.8k](/packages/nilgems-laravel-textract)

PHPackages © 2026

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