Download the PDF in Landscape mode using MPDF

| By Webner

While downloading the PDF from standard portrait mode to landscape mode, first of all you need to set the style in % (no hard coding of width or height). Then make an object of mpdf class.

This is how we created the object :

$mpdf=new mPDF('c', 'A4-L'); ā€œ-Lā€ is used to force the Landscape page orientation of document. mPDF can accept a lot more arguments as listed below : 
$mpdf = new mPDF ( '', // mode - default '' '',// format - A4, for example, default '' 0,// font size - default 0 '',// default font family 15,// margin_left 15,// margin right 16,// margin top 16,// margin bottom 9, // margin header 9, // margin footer 'L'// L - landscape, P - portrait );

Pass the necessary parameters and values as per your requirement.

Leave a Reply

Your email address will not be published. Required fields are marked *