Skip to content

New usage in this version. Maybe you like it. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1d1465b
MPDF version 4.6 => 5.6
seyfer Jan 30, 2013
0da90d5
Rename View_MPDF to Kohana_MPDF. Don't extend View now.
seyfer Jan 30, 2013
d7dba14
Merge branch 'seyfer_mster'
seyfer Jan 30, 2013
5c08d43
Fix README and add comments.
seyfer Jan 30, 2013
ecc18cd
Fix getting css from file
seyfer Feb 1, 2013
43debb2
Add magic __call() method to provide access to mPDF class methods.
seyfer Feb 14, 2013
fa78ba1
Fix README
seyfer Feb 21, 2013
b7df0a2
Fix ttf
seyfer Jul 15, 2013
a60e343
Upgrade to MPDF 5.7
seyfer Jul 15, 2013
679e477
Data can be not array
seyfer Oct 9, 2013
3161ab1
Refactoring. Using composer for mPDF loading.
seyfer Dec 10, 2013
3b9ec5c
Develop new features
seyfer Dec 10, 2013
b4062c8
update git ignore
seyfer Dec 10, 2013
e6f0354
Add feature to parse PDF from string and merge PDF files.
seyfer Dec 10, 2013
312d0b6
Fix merge bug and refactor
seyfer Dec 10, 2013
141d4e0
Update README
seyfer Dec 10, 2013
be9bb0d
Merge branch '3.2/master'
seyfer Dec 29, 2014
cc10fdd
Fix composer and code style
seyfer Dec 29, 2014
5826ead
Fix composer json for adding to packagist
seyfer Dec 30, 2014
851de09
Add composer lock
seyfer Dec 30, 2014
3a0f160
Merge branch '3.2/master'
seyfer Dec 30, 2014
17ed7a6
Try add dev stability
seyfer Dec 30, 2014
b967355
Merge branch 'master' into 3.2/master
seyfer Dec 30, 2014
e3484aa
Fix composer autoload
seyfer Dec 30, 2014
fbf88dd
Fix tmp dir path
seyfer Dec 30, 2014
0b363ef
Merge branch '3.2/master'
seyfer Dec 30, 2014
c8516fb
Fix file names
seyfer Dec 30, 2014
918b634
Merge branch '3.3/master'
seyfer Dec 30, 2014
1651c51
Fix composer
seyfer Jan 9, 2015
0e7fe97
Merge branch '3.3/master'
seyfer Jan 9, 2015
cde3512
Bug with mPDF 6
saruman May 9, 2015
189c0cf
Merge pull request #1 from saruman/patch-1
seyfer May 9, 2015
46f71c8
Update README.md
seyfer May 9, 2015
97309f3
Update README.md
seyfer May 9, 2015
d5c63b6
Merge branch '3.3/master' of github.com:seyfer/kohana-mpdf into 3.3/m…
seyfer May 11, 2015
d05f217
Updates
saruman May 11, 2015
19f366c
Merge branch '3.3/master' of https://github.com/saruman/kohana-mpdf i…
seyfer May 11, 2015
04a33bb
Merge branch 'saruman-3.3/master' into 3.3/master
seyfer May 11, 2015
786ce5a
Merge branch '3.3/master'
seyfer May 11, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/
tmp/
42 changes: 0 additions & 42 deletions README

This file was deleted.

92 changes: 78 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
# PDF View

Extension for Kohana's View class that renders as a PDF instead of HTML. Uses [MPDF](http://code.google.com/p/dompdf/) to render normal HTML views as PDF Files.
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

If your application is a Git repository:
Use Composer!

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

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

git submodule add git://github.com/ener/mpdf.git modules/mpdf
git submodule update --init
To install from Git:

Or clone the the module separately:
{
"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"
}
}
}

cd modules
git clone git://github.com/ener/mpdf.git mpdf
After installation go to module folder and execute

### Update DOMPDF
composer install

cd modules/mpdf
git submodule update --init
This will load mPDF to vendor dir. After that add to your app `index.php` at the beginning

```
require vendor/autoload.php
```

### Configuration

Expand All @@ -34,9 +57,50 @@ Edit `application/bootstrap.php` and add a the module:
Placed in a controller action:

// Load a view using the PDF extension
$pdf = View_MPDF::factory('pdf/example');

// Use the PDF as the request response
$this->request->response = $pdf;
$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 http://www.mpdf1.com/ documentation.
Loading