https://github.com/pguso/portabledocumentbundle
Easy to use pdf service
https://github.com/pguso/portabledocumentbundle
Last synced: 5 months ago
JSON representation
Easy to use pdf service
- Host: GitHub
- URL: https://github.com/pguso/portabledocumentbundle
- Owner: pguso
- Created: 2014-07-23T15:00:27.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-07-25T08:33:11.000Z (almost 12 years ago)
- Last Synced: 2025-07-24T16:25:55.868Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 145 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PortableDocumentBundle
======================
PortableDocumentBundle is a PHP (5.3+) wrapper for the mPDF Library.
It allows you to generate pdfs from html.
Installation
------------
With [composer](http://packagist.org), add:
```json
{
"require": {
"prg/portabledocument-bundle": "dev-master"
}
}
```
Then enable it in your kernel:
```php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
//...
new PRG\PortableDocumentBundle\PRGPortableDocumentBundle(),
//...
```
### Render a pdf document as response from a controller
```php
$pdfGenerator = $this->get('pguso.mpdf');
$html = $this->renderView('YourBundle:Folder:file.html.twig', array(
'args' => $args
));
return new Response(
$pdfGenerator->generateFromView($html, array(
'stylesheet' => '/pdf/style.css' //optional
))
);
```