phihuynh/html2pdfbundle

Use HTML2PDF as a Symfony Service

dev-master 2020-04-27 20:31 UTC

This package is not auto-updated.

Last update: 2024-04-24 14:45:44 UTC


README

SensioLabsInsight Build Status

Html2pdf for Symfony 4 or 5 as a service.

How to install ?

Just add this to your composer.json file:

"require": {
  ...
  "phihuynh/html2pdfbundle": "dev-master",
}

How to use ?

In your action:

use Ensepar\Html2pdfBundle\Factory\Html2pdfFactory;

public function yourAction(Request $request, Html2pdfFactory $html2pdfFactory){
  ...
  $html2pdf = $html2pdfFactory->create();
}

You can pass every option you would pass to html2pdf, for instance :

$html2pdf = $html2pdfFactory->create('P', 'A4', 'en', true, 'UTF-8', array(10, 15, 10, 15));

How to run the tests ?

composer install
phpunit