prezent / dompdf-bundle
Integrates the dompdf library into a Symfony application
Installs: 4 301
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 6
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.4
- dompdf/dompdf: ^2.0
- symfony/framework-bundle: ^4.4|^5.4|^6.0
Suggests
- symfony/twig-bundle: To render a PDF using a Twig template
This package is auto-updated.
Last update: 2024-12-05 17:22:19 UTC
README
Integrates Dompdf into a Symfony project.
Note
If you're looking to use DomPDF 0.6.2 or older, use the latest 1.x version of this bundle.
Installation
This bundle can be installed using Composer:
$ php composer.phar require prezent/dompdf-bundle
Then, activate the bundle in your kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Prezent\DompdfBundle\PrezentDompdfBundle(), ); }
Configuration
Since Dompdf 0.7.0, settings in the dompdf_config.inc.php
are no longer supported.
Set your options at runtime:
$pdf = $this->get('dompdf.twig'); $options = $pdf->getOptions(); $options->setFontDir($customDirectory); $pdf->setOrientation('portrait'); $pdf->setPaperSize('a4');
If you have defined one of the following old settings, they will be mapped to the following Options:
DOMPDF_CHROOT
-> Options->setChroot(DOMPDF_CHROOT);
DOMPDF_DIR
-> Options->setRootDir(DOMPDF_DIR);
DOMPDF_TEMP_DIR
-> Options->setTempDir(DOMPDF_TEMP_DIR);
DOMPDF_FONT_DIR
-> Options->setFontDir(DOMPDF_FONT_DIR);
DOMPDF_FONT_CACHE
-> Options->setFontCache(DOMPDF_FONT_CACHE);
DOMPDF_LOG_OUTPUT_FILE
-> Options->setLogOutputFile(DOMPDF_LOG_OUTPUT_FILE);
DOMPDF_DPI
-> Options->setDpi(DOMPDF_DPI);
DOMPDF_DEFAULT_PAPER_SIZE
-> Options->setDefaultPaperSize(DOMPDF_DEFAULT_PAPER_SIZE);
DOMPDF_ENABLE_REMOTE
-> Options->setIsRemoteEnabled(DOMPDF_ENABLE_REMOTE);
DOMPDF_ENABLE_PHP
-> Options->setIsPhpEnabled(DOMPDF_ENABLE_PHP);
DOMPDF_DEFAULT_FONT
-> Options->setDefaultFont(DOMPDF_DEFAULT_FONT);
DOMPDF_FONT_HEIGHT_RATIO
-> Options->setFontHeightRatio(DOMPDF_FONT_HEIGHT_RATIO);