PHP code example of mikemix / dompdfmodule

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

    

mikemix / dompdfmodule example snippets


     'dompdfmodule',
     



// some controller

    public function indexAction()
    {
        /** @var \Dompdf\Dompdf $dompdf */
        $dompdf = $this->getServiceLocator()->get('dompdf');
        $dompdf->load_html('<strong>Ehlo World</strong>');
        $dompdf->render();

        file_put_contents(__DIR__ . '/document.pdf', $dompdf->output());
    }