PHPackages                             seyfer/kohana-mpdf - 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. seyfer/kohana-mpdf

ActiveKohana-module[PDF &amp; Document Generation](/categories/documents)

seyfer/kohana-mpdf
==================

Kohana module to manage pdf quick and easy

8582PHP

Since May 9Pushed 10y ago4 watchersCompare

[ Source](https://github.com/seyfer/kohana-mpdf)[ Packagist](https://packagist.org/packages/seyfer/kohana-mpdf)[ RSS](/packages/seyfer-kohana-mpdf/feed)WikiDiscussions 3.3/master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

PDF View
========

[](#pdf-view)

Extension for Kohana a PDF instead of HTML. Uses [MPDF](http://www.mpdf1.com/mpdf/) to render normal HTML views as PDF Files.

Forked to fix for use View rendered templates with Kohana Smarty module. Now improoved with new features, like reading from string, merging PDF, etc.

mPDF version 5.7.1a !

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

[](#installation)

Use Composer!

To install from packagist [link](https://packagist.org/packages/seyfer/kohana-mpdf):

```
"seyfer/kohana-mpdf": "dev-master"

```

To install from Git:

```
{
    "type": "package",
    "package": {
        "name": "kohana/modules/mpdf",
        "version": "3.3",
        "source": {
            "type": "git",
            "url": "https://github.com/seyfer/kohana-mpdf.git",
            "reference": "3.3/master"
        }
    }
}

```

After installation go to module folder and execute

```
composer install

```

This will load mPDF to vendor dir. After that add to your app `index.php` at the beginning

```
require vendor/autoload.php

```

### Configuration

[](#configuration)

Edit `application/bootstrap.php` and add a the module:

```
Kohana::modules(array(
    ...
    'mpdf' => 'modules/mpdf',
    ...
));

```

Usage
-----

[](#usage)

Placed in a controller action:

```
// Load a view using the PDF extension
$mpdf = Kohana_MPDF::factory('pdf/example');
//Or use it with some data and with Smarty
$mpdf = Kohana_MPDF::factory("pdf/example.tpl", array("data" => $data));

//Set data for wiew later
$mpdf->setData($data);
//Or directly to PDF
$mpdf->setDataToPdf($data);

// Use CSS
$mpdf->setCss('media/css/style.css');
// And again. This is array.
$mpdf->setCss('media/css/style2.css');
//Or set array of CSS path directly to PDF
$mpdf->setCssToPdf($array);

//Render pdf with your html template and css
$mpdf->render();

//Check output with different output mode (see MPDF documentation).
$mpdf->output('mpdf.pdf', 'S');

```

Extended usage

```
//You can set some options
$mpdf->setCharset($charset);
$mpdf->setSourceFile($filePath);
$mpdf->setImportUse();
$mpdf->setFormat('A4');

//Save to tmp path
$mpdf->saveTpmPdfFile($data, $name);
//You can load PDF file in one command from tmp path
$mpdf->loadPdfFile($fileName);

//And finally! Parse PDF from string, not file
$mpdf->parsePdfString($pdfBinData);

//Merge different PDF to one
$mpdf = new Kohana_MPDF();
$mpdf->mergePdf(1.pdf);
$mpdf->mergePdf(2.pdf);
$mpdf->output();

```

You can call any mPDF methods.

For all mPDF methods see  documentation.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/71775d95a4c19f629135c951e986592c79f63ed0f38c4eabfa767f5144909ea9?d=identicon)[seyfer](/maintainers/seyfer)

---

Top Contributors

[![seyfer](https://avatars.githubusercontent.com/u/1483925?v=4)](https://github.com/seyfer "seyfer (36 commits)")[![ener](https://avatars.githubusercontent.com/u/298270?v=4)](https://github.com/ener "ener (4 commits)")[![saruman](https://avatars.githubusercontent.com/u/813190?v=4)](https://github.com/saruman "saruman (2 commits)")

### Embed Badge

![Health badge](/badges/seyfer-kohana-mpdf/health.svg)

```
[![Health](https://phpackages.com/badges/seyfer-kohana-mpdf/health.svg)](https://phpackages.com/packages/seyfer-kohana-mpdf)
```

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M216](/packages/smalot-pdfparser)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.1k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)

PHPackages © 2026

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