0
我正在使用mPDF(http://mpdf.bpm1.com)創建pdf收據,但此時它們僅顯示在完整的A4頁面上。在mPDF上更改頁面大小並使瀏覽器自動打印顯示的PDF文件
我想將它們調整到合理的尺寸,因爲我們使用的是epson tm-t88iv。這是我的第一個困境。
我遇到的第二個問題涉及在連接的打印機上調用自動打印。
我想在處理表單時(在同一頁上)執行此操作。
但我不知道如何落實到代碼這一點,我現在所擁有的:
<?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;
//==============================================================
//==============================================================
//==============================================================
//==============================================================
//==============================================================
?>