Портированый mPDF для Kohana 3.3 и 3.2
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 38 commits ahead of ener:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


PDF View

Extension for Kohana a PDF instead of HTML. Uses 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 !


Use Composer!

To install from packagist link:

"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


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

    'mpdf' => 'modules/mpdf',


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
//Or directly to PDF

// Use CSS
// And again. This is array.
//Or set array of CSS path directly to PDF

//Render pdf with your html template and css

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

Extended usage

//You can set some options

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

//And finally! Parse PDF from string, not file

//Merge different PDF to one
$mpdf = new Kohana_MPDF();

You can call any mPDF methods.

For all mPDF methods see http://www.mpdf1.com/ documentation.