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

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

sglms/pdf
=========

A simple (but efficient) mPDF wrapper for Laravel (&gt;=12).

0.3(9mo ago)1120MITPHPPHP &gt;=8.3

Since Aug 8Pushed 9mo agoCompare

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

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

SglmsPdf (Laravel Mpdf Wrapper)
===============================

[](#sglmspdf-laravel-mpdf-wrapper)

Simple Laravel (^12.0) wrapper for Mpdf, using Laravel's view components.

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

[](#installation)

```
composer require sglms/pdf
```

Laravel's auto-discovery features will register the service provider and facade.

Usage
-----

[](#usage)

For the impatient:

```
use Sglms\Pdf;

$pdf = Pdf::view('pdf.filename')->output('filename.pdf');
```

### View Parameters

[](#view-parameters)

```
use Sglms\Pdf;

$pdf = Pdf::view(
	'pdf.filename',
	['param' => 'value']	/* [Optional */
);
$pdf->output('filename.pdf');

/* Or, ... */

$pdf->save('filename');

/* Or, store it 'the Laravel way' */

$pdf->storeAs('filename', 'disk');
```

### Configuration and Header/Footer

[](#configuration-and-headerfooter)

```
$pdf = Pdf::init(
	config: ['format' => 'letter'],
	header: 'pdf.header',
	footer: 'pdf.footer'
	stylesheet: 'path/to/stylesheet.css'
);
```

Add your logo (available as 'var:logo' in your views):

```
$pdf->logo('path/to/logo.svg');
```

Remember to add your logo before header/footer setup, if you plan to use it there.

You can override the setup if you need parameters:

```
$pdf->header('pdf.header', ['param' => 'value']);
$pdf->footer('pdf.footer', ['param' => 'value']);
```

Include your header **before** adding views to the pdf. This is a limitation of mPDF in that it calls `AddPage()` when you include a view (or any other html), and if the header is not set, mpdf will render the header blank.

Concatenate multiple views:

```
$pdf = Pdf::init();
$pdf->view('pdf.one')->view('pdf.two')->output('filename.pdf');
```

Sign your document:

```
$pdf->sign('pdf.signature', ['name' => 'John Doe']);
```

Or, ...

```
$pdf->sign(
	signature: 'pdf.signature',
	data: ['name' => 'John Doe'],
	x: 50,		/* [mm] */
	y: 100,		/* [mm] */
	width: 100	/* [mm] */
);
```

You can also load and sign an existing PDF file:

```
$pdf->signFile('pdf.signature, 'path/to/pdf');
```

If you need the base mPDF to work on it further:

```
$pdf->get();
```

### Use it in your controller

[](#use-it-in-your-controller)

```
use Sglms\Pdf;

class CustomController extendes Controller
{
	// ...
	public function render() {
        $pdf = Pdf::view('pdf.filename')->sign('pdf.signature');
        return response($pdf->output(), 200)
        	->header('Content-Type', 'application/pdf')
         	->header('Content-Disposition', 'inline; filename="document.pdf"');
    }
    //...
}
```

Limitations
-----------

[](#limitations)

As mentioned, very simple (but efficient) wrapper, that works with Laravel 12 (php &gt;=8.3; mpdf &gt;= 8.x).

It's better suited for single page document generation.

### Rationale

[](#rationale)

This package is part of a larger project in which we needed to generate a large number of one-page documents and (digitally) sign them.

License
-------

[](#license)

Sglms/Pdf is licensed under the The MIT License.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance58

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Every ~2 days

Total

3

Last Release

278d ago

PHP version history (2 changes)0.1PHP &gt;=8.2

0.2PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/665f16296120905cc67e3025bb3e42a622f647a97f6a546f0c332cd7e43a3054?d=identicon)[jaimercz](/maintainers/jaimercz)

---

Top Contributors

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

---

Tags

laravellaravel-packagempdfpdf-generationpdf-wrapperlaravelpdfsignaturempdfsglms

### Embed Badge

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

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

###  Alternatives

[carlos-meneses/laravel-mpdf

Laravel Mpdf: Using Mpdf in Laravel to generate Pdfs.

4403.1M7](/packages/carlos-meneses-laravel-mpdf)

PHPackages © 2026

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