PHP code example of es / dompdf-bundle
1. Go to this page and download the library: Download es/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/ */
es / dompdf-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new ES\DompdfBundle\ESDompdfBundle(),
// ...
);
}
// Set some html and get the service
$html = '<h1>Sample Title</h1><p>Lorem Ipsum</p>';
$dompdf = $this->get('dompdf');
// Stream the pdf to the browser
$dompdf->streamHtml($html, "document.pdf");
// Get binary content of the pdf document
$dompdf->getPdf($html);
php composer.phar