127
rated 0 times
[
129]
[
2]
/ answers: 1 / hits: 22320
/ 14 Years ago, thu, december 2, 2010, 12:00:00
I am using mPDF (http://mpdf.bpm1.com) to create pdf receipts, but at the moment they only display on a full A4 page.
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.
The second problem I have involves invoking auto print on the printer attached.
I would like to do this when the form is processed (on the same page).
But I'm not sure how to implement this into the code I 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 BY '.$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 YOU FOR YOUR PAYMENT. PLEASE KEEP THIS RECEIPT FOR FUTURE REFERENCE. YOU WILL BE ASKED TO PRESENT IT AS EVIDENCE OF PAYMENT MADE.</span>
</div>';
//==============================================================
//==============================================================
//==============================================================
include(mpdf/mpdf.php);
$mpdf=new mPDF('UTF-8-s','');
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
//==============================================================
//==============================================================
//==============================================================
//==============================================================
//==============================================================
?>
More From » php