Question

I am implementing an application in Yii php, and I am trying to make PDFs using the mPDF extension.

I'm generating a sort of Summary Report where I make a pdf for it. Inside the generated pdf are 3 widgets, basically tables to create that report.

Here's how it looks:

$mPDF1 = Yii::app()->ePdf->mpdf();

$mPDF1 = Yii::app()->ePdf->mpdf('', 'A5');
..
..//set mpdf properties etc..

$mPDF1->WriteHTML($stylesheet, 1);

$mPDF1->WriteHTML($html1,2);
//say $html1 is a widget/table  with a portrait orientation

$mPDF1->WriteHTML($html2,2);
//$html2 is a widget/table with a portrait orientation

$mPDF1->WriteHTML(&html3,2);
//$html3 is a widget/table that needs to have a landscape orientation because it's too long.

//and then output the pdf and so on..

Above code works, but displays the tables all in a portrait orientation, I need to display the table in $html3 in a landscape orientation. Is there a way to do this?mpdF properties I guess or something. And also, is is there a way to separate $html3 and have it on the start of the next page in the same PDF?

Was it helpful?

Solution

Try to AddPage with Landscape orientation:

$mPDF1->WriteHTML($html2,2);
//$html2 is a widget/table with a portrait orientation

$mPDF1->AddPage('L');
$mPDF1->WriteHTML(&html3,2);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top