mPDF in CodeIgniter page orientation won't do landscape mPDF in CodeIgniter page orientation won't do landscape codeigniter codeigniter

mPDF in CodeIgniter page orientation won't do landscape


My name is Rhonald Brito, it is my first time here, I have about 1 year using Codeigniter and MPDF, here I let you know my code:

public function Make_PDF($view, $data, $file_name) {    $html = $this->load->view($view, $data, true);    $this->mpdf = new mPDF();    $this->stylesheet = file_get_contents('css/style.css');    $this->mpdf->AddPage('L', // L - landscape, P - portrait            '', '', '', '',            30, // margin_left            30, // margin right            30, // margin top            30, // margin bottom            18, // margin header            12); // margin footer    $this->mpdf->WriteHTML($html);    //$this->mpdf->Output($file_name, 'D'); // download force    $this->mpdf->Output($file_name, 'I'); // view in the explorer    // for more information rhonalejandro@gmail.com}


When creating your new PDF use the following to set it to landscape

$mpdf = new mPDF('utf-8', 'L');

Hope this helps

More information here


Set format to 'A4-L' in constructor.