Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging page size on mPDF and getting browser to auto print PDF file on display
    text
    copied!<p>I am using mPDF (<a href="http://mpdf.bpm1.com" rel="nofollow">http://mpdf.bpm1.com</a>) to create pdf receipts, but at the moment they only display on a full A4 page. </p> <p>I would like to resize them down to a reasonable size because we are using a epson tm-t88iv. This is the first dilemma I have. </p> <p>The second problem I have involves invoking auto print on the printer attached. </p> <p>I would like to do this when the form is processed (on the same page). </p> <p>But I'm not sure how to implement this into the code I have right now:</p> <pre><code> &lt;?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 = ' &lt;style&gt; @page { margin-top: 20px; margin-left: 20px; } &lt;/style&gt; &lt;div style="text-align:center; font-family: Arial, Helvetica, sans-serif;"&gt; &lt;div style="border: 0px; padding: 0px; width: 175px; text-align:center;"&gt; &lt;img src="resources/speedline.png" width="161" height="58" /&gt; &lt;p style="font-weight: bold;" align="center"&gt; DRIVER '.$id.' RECEIPT&lt;/p&gt; &lt;p style="font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;'.$week.'&lt;/p&gt; &lt;span style="font-size: 10px;"&gt;PROCESSED BY '.$user.'&lt;/span&gt;&lt;p&gt; &lt;table width="100%" border="0" cellspacing="0" cellpadding="0" &gt; &lt;tr&gt; &lt;td align="left" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;"&gt;DATE PAID&lt;/td&gt; &lt;td style="font-size: 12px; font-family: Arial, Helvetica, sans-serif;" align="right"&gt;'.$pDate.'&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;"&gt;TOTAL RENT&lt;/td&gt; &lt;td style="font-size: 12px; font-family: Arial, Helvetica, sans-serif;" align="right"&gt;£'.$pRent.'&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;"&gt;RENT PAID&lt;/td&gt; &lt;td style="font-size: 12px; font-family: Arial, Helvetica, sans-serif;" align="right"&gt;£'.$rentPaid.'&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;"&gt;REMAINING&lt;/td&gt; &lt;td align="right" style="font-family: Arial, Helvetica, sans-serif;"&gt;£'.$result.'&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br /&gt; &lt;span style="font-size:8px"&gt;THANK YOU FOR YOUR PAYMENT. PLEASE KEEP THIS RECEIPT FOR FUTURE REFERENCE. YOU WILL BE ASKED TO PRESENT IT AS EVIDENCE OF PAYMENT MADE.&lt;/span&gt; &lt;/div&gt;'; //============================================================== //============================================================== //============================================================== include("mpdf/mpdf.php"); $mpdf=new mPDF('UTF-8-s',''); $mpdf-&gt;WriteHTML($html); $mpdf-&gt;Output(); exit; //============================================================== //============================================================== //============================================================== //============================================================== //============================================================== ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload