I am using MPDF in codeigniter but it is always portrait..
Why is it always portrait ?
public function downloadstatisticsWeek1()
{
$data = [];
$html = $this->load->view('pdf/weeklyKeyIndicatorReportWeek1', $data, true);
$pdfFilePath = "Pcdom Statistics As of ". date('F d Y')." .pdf";
$this->load->library('pcdom_pdf_converter');
$
$param = '"en-GB-x","Letter-L","","",10,10,10,10,6,3';
$pdfer = new mPDF($param);
$pdfer->WriteHTML($html);
$pdfer->output($pdfFilePath, "D");
}
It my $para is incorrect?
Try to remove $param, see following:
//$param = '"en-GB-x","Letter-L","","",10,10,10,10,6,3';
$pdfer = new mPDF("en-GB-x","Letter-L","","",10,10,10,10,6,3);
Your code problem: you are passing one string into mPDF(), the string which is not valid.
If you would like to re-use the param, you could try following version (But I did not tested, ps: it for mPDF version 7), detail please refer this documentation.
$param = array(
'mode' => 'en-GB-x',
'format' => 'Letter-L',
'margin_left' => 10,
'margin_right' => 10,
'margin_top' => 10,
'margin_bottom' => 10,
'margin_header' => 6,
'margin_footer' => 3
);
Finally, you may also consider this function AddPage() too.