94noni / html2pdf-bundle
Html2pdf for Symfony.
Fund package maintenance!
fabpot
Tidelift
symfony.com/sponsor
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.4
- spipu/html2pdf: ^5.2
- symfony/dependency-injection: ^5.4|^6.0
- symfony/http-kernel: ^5.4|^6.0
Requires (Dev)
- symfony/framework-bundle: ^5.4|^6.0
- symfony/yaml: ^5.4|^6.0
README
Fork of the original
Difference with latest v0.x is the support of Symfony v6+ and PHP v8+, tagged here as v1.
Used for personal projects to render some PDF.
History
Html2pdf for Symfony applications.
Please read FrDeamon/EnseparHtml2pdfBundle#37
How to install?
Use Composer to install it:
$ composer require 94noni/html2pdf-bundle
Enable it in your config/bundles.php
file:
Noni\Html2pdfBundle\NoniHtml2pdfBundle::class => ['all' => true],
How to use?
In your code:
use Noni\Html2pdfBundle\Factory\Html2pdfFactory; class MyClass { private Html2pdfFactory $html2pdfFactory; public function __construct(Html2pdfFactory $html2pdfFactory) { $this->html2pdfFactory = $html2pdfFactory; } }
You can pass every options you would pass to Html2pdf
, for instance:
$html2pdfFactory = $this->html2pdfFactory->create('P', 'A4', 'en', true, 'UTF-8', [10, 15, 10, 15]);
If the previous arguments are not provided, the factory uses its own default values. You can configure those default values by adding the bundle configuration to your config file:
noni_html2pdf: orientation: 'P' format: 'A4' lang: 'en' unicode: true encoding: 'UTF-8' margin: [10, 15, 10, 15]
Read more on the library Html2pdf
here.