rdmumayan / html2pdf-bundle
Forked version of Tristan's html2pdf-bundle. Use HTML2PDF as a Symfony2 Service
Installs: 155
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 22
Type:symfony-bundle
Requires
- php: >=5.4
- rdmumayan/html2pdf: ~0.0
- symfony/symfony: >=2.0
Requires (Dev)
- phpunit/phpunit: ^7.2 || ^6.5 || ^4.8
- sensio/framework-extra-bundle: ~3.0
README
Html2pdf for Symfony 2 as a service.
How to install ?
Just add this to your composer.json file:
"require": { ... "ensepar/html2pdf-bundle" : "~2.0" }
Enable it in the Kernel
new Ensepar\Html2pdfBundle\EnseparHtml2pdfBundle(),
How to use ?
In your action:
$html2pdf = $this->get('html2pdf_factory')->create();
You can pass every option you would pass to html2pdf, for instance :
$html2pdf = $this->get('html2pdf_factory')->create('P', 'A4', 'en', true, 'UTF-8', array(10, 15, 10, 15));
If the previous arguments are not provided, the factory uses its own default values. You can
change this default values by adding the bundle configuration to your app/config/config.yml
:
ensepar_html2pdf: orientation: P format: A4 lang: en unicode: true encoding: UTF-8 margin: [10,15,10,15]
How to run the tests ?
composer install
phpunit