reinfi / zf-dompdf-module
A Zend Framework 2 module for incorporating DOMPDF support.
v1.0
2017-06-15 19:29 UTC
Requires
- php: >=5.6
- dompdf/dompdf: ^0.8
- zendframework/zend-mvc: ^2.5
- zendframework/zend-view: ^2.5
This package is auto-updated.
Last update: 2025-02-10 05:32:43 UTC
README
The DOMPDF module integrates the DOMPDF library with Zend Framework 2 with minimal effort on the consumer's end.
Requirements
Installation
Installation of DOMPDFModule uses PHP Composer. For more information about PHP Composer, please visit the official PHP Composer site.
Installation steps
-
composer require "reinfi/zf-dompdf-module"
-
open
my/project/directory/config/application.config.php
and add the following key to yourmodules
:'ZFDomPdf',
Configuration options
You can override options via the dompdf
key in your local or global config files.
See Dompdf class for all options.
Usage
<?php 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; } }