Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
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>&nbsp;</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>&nbsp;</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

 Answers
35

Try:
$mpdf = new mPDF('', 'Letter', 0, '', 12.7, 12.7, 14, 12.7, 8, 8);



and adjust the values at the end for the margins you want. Check out their documentation



Sorry, not sure about auto printing, but there is some info here


[#94767] Tuesday, November 30, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
frederickmohamedw

Total Points: 21
Total Questions: 123
Total Answers: 105

Location: The Bahamas
Member since Tue, Apr 27, 2021
3 Years ago
frederickmohamedw questions
Wed, Sep 23, 20, 00:00, 4 Years ago
Sat, Jul 18, 20, 00:00, 4 Years ago
Sun, Apr 26, 20, 00:00, 4 Years ago
Sat, Jan 11, 20, 00:00, 4 Years ago
Fri, Dec 27, 19, 00:00, 4 Years ago
;