Yii2: How to add page in a PDF file generated using kartik-mpdf?

$pdf->AddPage(); - not working (Calling unknown method: kartik\mpdf\Pdf::AddPage())
August 19th 19 at 23:18
1 answer
August 19th 19 at 23:20
$pdf->getApi()->addPage()
Thank you!

And then a question. The new page is added, but it pulls no CSS. and why add a page to the beginning of my document and not after the page is created the above code ?

public function actionPdf($id) {
$content = Portfolio::find()->where("id=$id")->one();

$model = $this->findModel($id);
$image = $model->getImages();

$pdf = new Pdf([
'mode' => Pdf::MODE_UTF8, // leaner size using standard fonts
'content' => $this->renderPartial('pdf', compact(
'content',
'image'
)),
'options' => [
'title' => '.pdf',
],
'format' => Pdf::FORMAT_A4,
'marginTop' => 0,
'marginLeft' => 0,
'marginRight' => 0,
'cssFile' => 'css/pdf.css',
'orientation' => Pdf::ORIENT_LANDSCAPE,
'destination' => Pdf::DEST_BROWSER,
'filename' => ('-reply-' . '.pdf'),

]);

$content = 'pdf content';
$pdf->getApi()->WriteHTML($content);
$pdf->getApi()->AddPage();

return $pdf->render();
} - Sid.Gutkowski commented on August 19th 19 at 23:23

Find more questions by tags Yii