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

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

dotblue/nette-pdf
=================

Simple management of PDF generation in Nette app using mPDF

3.3.0(3y ago)743.6k↓37.2%4[3 PRs](https://github.com/dotblue/nette-pdf/pulls)BSD-3-ClausePHPPHP &gt;=7.3

Since Nov 27Pushed 3y ago3 watchersCompare

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

READMEChangelogDependencies (4)Versions (10)Used By (0)

#### Requirements

[](#requirements)

- PHP 7.3+
- [mpdf/mpdf](https://github.com/finwe/mpdf) ~7.0
- [nette/application](https://github.com/nette/application) &gt;= 3.0
- [nette/di](https://github.com/nette/di) &gt;= 3.0
- [nette/utils](https://github.com/nette/utils) &gt;= 3.0

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

[](#installation)

1. Copy source using [Composer](http://getcomposer.org/):

```
$ composer require dotblue/nette-pdf@~3.0
```

2. Register as Configurator's extension:

```
extensions:
	mpdf: DotBlue\Mpdf\DI\Extension

```

Configuration
-------------

[](#configuration)

First you need to tell the addon where you store PDF documents' templates.

```
mpdf:
	templatesDir: %appDir%/templates/pdf

```

In the app, you usually have several types of PDF documents that you wish to generate. Such type is called *theme*. Each theme should have its own directory located in `templatesDir`. You can configure theme via many directives which mPDF supports.

```
mpdf:
	themes:
		invoice:
			margin:
				left: 20
				right: 20
				top: 20
				bottom: 20

```

Default settings are following:

```
encoding: utf-8
img_dpi: 120
format: A4
margin:
	left: 0
	right: 0
	top: 0
	bottom: 0

```

Each theme has built-in support for external stylesheet. If you put `style.css` file into theme's directory, it will be automatically bundled into PDF document.

### Fonts

[](#fonts)

Custom fonts can be configured in following way:

```
fonts:
	roboto:
		R: %appDir%/fonts/Roboto.ttf

```

Supported types are R (regular), B (bold), I (italic) and BI (bold &amp; italic).

Usage
-----

[](#usage)

There is only one service: `DotBlue\Mpdf\DocumentFactory`. Granted that you have `default.latte` file in our `invoice` theme directory, you can create new PDF document like this:

```
$invoiceDocument = $documentFactory->createPdf('invoice');
```

Variable `$invoiceDocument` is instance of `DotBlue\Mpdf\Document`, which provides simple API for printing or saving, and for linking images. If you would like to save the invoice somewhere on hard drive, you can call `saveTo()` method.

```
$invoiceDocument->saveTo(__DIR__ . '/invoice.pdf');
```

Or you can show document to user in browser:

```
$invoiceDocument->printPdf();
```

### Variants

[](#variants)

Theme can support more variants. Actually method `createPdf()` has second optional argument, and its default value is `default.latte`. By changing this, your theme can support many variants either of type or for example of localization.

As third argument you can pass array of directives right for mPDF, which will override your theme default settings.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~386 days

Recently: every ~496 days

Total

9

Last Release

1097d ago

Major Versions

1.0.0 → 2.0.02017-02-23

2.3.0 → 3.0.02019-07-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/920689f25a0fc31b2807556eddd47203f33c4318893bce98818cf2f3e627ee8e?d=identicon)[vojtechdobes](/maintainers/vojtechdobes)

---

Top Contributors

[![vojtech-dobes](https://avatars.githubusercontent.com/u/415925?v=4)](https://github.com/vojtech-dobes "vojtech-dobes (16 commits)")[![enumag](https://avatars.githubusercontent.com/u/539462?v=4)](https://github.com/enumag "enumag (2 commits)")

---

Tags

extensionmpdfnettenette-applicationpdfpdf-generationpdfnettempdf

### Embed Badge

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

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

###  Alternatives

[contributte/pdf

Pdf response extension for Nette Framework

43967.8k2](/packages/contributte-pdf)[carlos-meneses/laravel-mpdf

Laravel Mpdf: Using Mpdf in Laravel to generate Pdfs.

4403.1M7](/packages/carlos-meneses-laravel-mpdf)[kartik-v/yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.

1605.5M84](/packages/kartik-v-yii2-mpdf)[kdyby/wkhtmltopdf

Wkhtmltopdf cli wrapper for Nette Framework

3966.0k](/packages/kdyby-wkhtmltopdf)

PHPackages © 2026

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