PHP code example of prezent / dompdf-bundle

1. Go to this page and download the library: Download prezent/dompdf-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

prezent / dompdf-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Prezent\DompdfBundle\PrezentDompdfBundle(),
    );
}

$pdf = $this->get('dompdf.twig');

$options = $pdf->getOptions();
$options->setFontDir($customDirectory);

$pdf->setOrientation('portrait');
$pdf->setPaperSize('a4');
bash
$ php composer.phar 

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);