Формирую документ в альбомной ориентации, он формируется на всю ширину страницы.
Код: Выделить всё
public function actionGeneratePdf($id)
{
Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
$model = $this->findModel($id);
$content = $this->renderPartial('form-pdf', ['model' => $model]);
// setup kartik\mpdf\Pdf component
Yii::$app->response->format = \yii\web\Response::FORMAT_RAW;
$pdf = new Pdf([
'mode' => Pdf::MODE_BLANK,
'destination' => Pdf::DEST_BROWSER,
'content' => $content,
'orientation' => Pdf::ORIENT_LANDSCAPE,
'methods' => [
'SetTitle' => 'Архивное дело: '.$model->title,
'SetSubject' => 'Титуальный лист архивного дела: '.$model->title,
'SetKeywords' => 'Yii2, PDF, MPDF, yii2-mpdf, архивное дело',
]
]);
return $pdf->render();
}