PHP code example of carlescliment / html2pdf-bundle

1. Go to this page and download the library: Download carlescliment/html2pdf-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/ */

    

carlescliment / html2pdf-bundle example snippets


    public function registerBundles()
    {
        $bundles = array(
            // ...
            new carlescliment\Html2PdfServiceBundle\carlesclimentHtml2PdfServiceBundle(),
        );

class SampleController extends Controller
{
    public function toPdfAction()
    {
        $view = $this->renderView('YourBundle:Sample:toPdf.html.twig');
        $bridge = $this->get('html2pdf.bridge');
        $options = array('footer-left' => 'my footer');
        return $bridge->getFromHtml($view, 'document_name', $options);
    }
}