PHP code example of nmalo / dompdf-bundle
1. Go to this page and download the library: Download nmalo/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/ */
nmalo / dompdf-bundle example snippets
// in AppKernel::registerBundles()
$bundles = array(
// Dependencies
new Slik\DompdfBundle\SlikDompdfBundle();
);
// Set some html and get the service
$html = '<h1>Sample html</h1>';
$dompdf = $this->get('slik_dompdf');
// Generate the pdf
$dompdf->getpdf($html);
// Either stream the pdf to the browser
$dompdf->stream("myfile.pdf");
// Or get the output to handle it yourself
$pdfoutput = $dompdf->output();