kartik_mpdf
MPDF
use kartik\mpdf\Pdf; ... $html = $this->renderPartial('/kandydaci/umowa-pdf', [ 'model' => $model, ]); $pdf = new Pdf([ 'mode' => 'utf-8', 'marginLeft' => 15, 'marginRight' => 15, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $html, //'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.cent{ width:100%; text-align:center; margin-bottom:0; margin-top:3px; } ol{ margin-top: 0; margin-bottom: 0; }', // set mPDF properties on the fly 'options' => ['title' => $nazwa_pliku], 'filename'=>$nazwa_pliku, // call mPDF methods on the fly 'methods' => [ // 'SetHeader' => ['Krajee Report Header'], 'SetFooter' => ['|Strona {PAGENO} z {nbpg}|'], ] ]); Yii::$app->response->format = \yii\web\Response::FORMAT_RAW; Yii::$app->response->headers->add('Content-Type', 'application/pdf'); return $pdf->render();
kartik_mpdf.txt · ostatnio zmienione: 2024/09/15 16:22 przez 127.0.0.1