php - Changing page size on mPDF and getting browser to auto print PDF file on display -
i using mpdf (http://mpdf.bpm1.com) create pdf receipts, @ moment display on full a4 page.
i resize them down reasonable size because using epson tm-t88iv. first dilemma have.
the second problem have involves invoking auto print on printer attached.
i when form processed (on same page).
but i'm not sure how implement code have right now:
<?php // post $id = $_get['id']; $user = $_get['user']; $week = $_get['week']; $prent = $_get['prent']; $rentpaid = $_get['rentpaid']; $result = $_get['result']; $pdate = date("d/m/y"); $html = ' <style> @page { margin-top: 20px; margin-left: 20px; } </style> <div style="text-align:center; font-family: arial, helvetica, sans-serif;"> <div style="border: 0px; padding: 0px; width: 175px; text-align:center;"> <img src="resources/speedline.png" width="161" height="58" /> <p style="font-weight: bold;" align="center"> driver '.$id.' receipt</p> <p style="font-size: 12px; font-family: arial, helvetica, sans-serif;">'.$week.'</p> <span style="font-size: 10px;">processed '.$user.'</span><p> <table width="100%" border="0" cellspacing="0" cellpadding="0" > <tr> <td align="left" style="font-weight: bold; font-family: arial, helvetica, sans-serif;">date paid</td> <td style="font-size: 12px; font-family: arial, helvetica, sans-serif;" align="right">'.$pdate.'</td> </tr> <tr> <td align="left"></td> <td> </td> </tr> <tr> <td align="left" style="font-weight: bold; font-family: arial, helvetica, sans-serif;">total rent</td> <td style="font-size: 12px; font-family: arial, helvetica, sans-serif;" align="right">£'.$prent.'</td> </tr> <tr> <td align="left" style="font-weight: bold; font-family: arial, helvetica, sans-serif;">rent paid</td> <td style="font-size: 12px; font-family: arial, helvetica, sans-serif;" align="right">£'.$rentpaid.'</td> </tr> <tr> <td align="left"> </td> <td></td> </tr> <tr> <td align="left" style="font-weight: bold; font-family: arial, helvetica, sans-serif;">remaining</td> <td align="right" style="font-family: arial, helvetica, sans-serif;">£'.$result.'</td> </tr> </table> <br /> <span style="font-size:8px">thank payment. please keep receipt future reference. asked present evidence of payment made.</span> </div>'; //============================================================== //============================================================== //============================================================== include("mpdf/mpdf.php"); $mpdf=new mpdf('utf-8-s',''); $mpdf->writehtml($html); $mpdf->output(); exit; //============================================================== //============================================================== //============================================================== //============================================================== //============================================================== ?>
try: $mpdf = new mpdf('', 'letter', 0, '', 12.7, 12.7, 14, 12.7, 8, 8);
and adjust values @ end margins want. check out their documentation
sorry, not sure auto printing, there info here
Comments
Post a Comment