Setup Krajee Pdf component
Download 13.57 Kb.
|
pdf widget
use kartik\mpdf\Pdf; // ...
'components' => [ 'pdf' => [ 'class' => Pdf::classname(), 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, // refer settings section for all configuration options ] ]
public function actionReport() { // get your HTML raw content without any layouts or scripts $content = $this->renderPartial('_reportView'); // setup kartik\mpdf\Pdf component $pdf = new Pdf([ 'mode' => Pdf::MODE_CORE, // A4 paper format 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, // stream to browser inline 'destination' => Pdf::DEST_BROWSER, 'content' => $content, // format content from your own css file if needed or use the // enhanced bootstrap css built by Krajee for mPDF formatting 'cssFile' => '@vendor/kartik-v/yii2-mpdf/src/assets/kv-mpdf-bootstrap.min.css', // any css to be embedded if required 'cssInline' => '.kv-heading-1{font-size:18px}', // set mPDF properties on the fly 'options' => ['title' => 'Krajee Report Title'], // call mPDF methods on the fly 'methods' => [ 'SetHeader'=>['Krajee Report Header'], 'SetFooter'=>['{PAGENO}'], ] ]); Download 13.57 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling