PHP code example of reinfi / zf-dompdf-module
1. Go to this page and download the library: Download reinfi/zf-dompdf-module 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/ */
reinfi / zf-dompdf-module example snippets
'ZFDomPdf',
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use ZFDomPdf\View\Model\PdfModel;
class ReportController extends AbstractActionController
{
public function monthlyReportPdfAction()
{
$pdf = new PdfModel();
$pdf->setOption('filename', 'monthly-report'); // Triggers PDF download, automatically appends ".pdf"
$pdf->setOption('paperSize', 'a4'); // Defaults to "8x11"
$pdf->setOption('paperOrientation', 'landscape'); // Defaults to "portrait"
// To set view variables
$pdf->setVariables(array(
'message' => 'Hello'
));
return $pdf;
}
}