Tips on Creating PDF using mPDF PHP library
In this post I will describe several ways to format HTML documents that will be converted into PDF file using mPDF PHP library. 1. Change Page Orientation Use CSS3 page and sheet-size attribute to change page orientation. <style type="text/css"> .landscape { page: a4landscape; } .portrait { page: a4portrait; } @page a4portrait { sheet-size: A4; } @page a4landscape { sheet-size: A4-L; } </style> <div class="landscape"> Portrait page </div> <div class="landscape"> Landscape page </div> 2. Change page margins To change page margins, you need to give additional parameter to mPDF's constructors. The page margins are in milimeters. Note the example uses Yii pdf extension instead of calling mPDF directly. $mPDF1 = Yii::app()->ePdf->mpdf('', 'A4',0,'',5,5); 3. Fit a table into one p