|
|
|
สอบถามการใช้งานการแปลง PHP เป็น PDF โดยการใช้ mPDF จะต้องทำอย่างไร |
|
|
|
|
|
|
|
จากภาพผมตั้ง Header ไว้ แต่ตารางข้อมูลกลับมาทับ Header
ผมต้องการให้หัวตารางเลื่อนลงมาอีกทุกหน้า เท่าๆ กัน
หรือมีวิธีการตั้งค่า Header ยังไงให้ทุกหน้าเหมือนกัน
CODE
Code (PHP)
<link type="text/css" href="style.css" />
<?php
require_once('../mpdf/mpdf.php');
$html = '
<main>
<table>
<thead>
<tr>
<th class="service">SERVICE</th>
<th class="desc">DESCRIPTION</th>
<th>PRICE</th>
<th>QTY</th>
<th>TOTAL</th>
</tr>
</thead>
<tbody>
<tr>
<td class="service">Design</td>
<td class="desc">Creating a recognizable design solution based on the company existing visual identity</td>
<td class="unit">$40.00</td>
<td class="qty">26</td>
<td class="total">$1,040.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr><tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">Development</td>
<td class="desc">Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="service">SEO</td>
<td class="desc">Optimize the site for search engines (SEO)</td>
<td class="unit">$40.00</td>
<td class="qty">20</td>
<td class="total">$800.00</td>
</tr>
<tr>
<td class="service">Training</td>
<td class="desc">Initial training sessions for staff responsible for uploading web content</td>
<td class="unit">$40.00</td>
<td class="qty">4</td>
<td class="total">$160.00</td>
</tr>
<tr>
<td class="service">Training</td>
<td class="desc">Initial training sessions for staff responsible for uploading web content</td>
<td class="unit">$40.00</td>
<td class="qty">4</td>
<td class="total">$160.00</td>
</tr>
<tr>
<td class="service">Training</td>
<td class="desc">Initial training sessions for staff responsible for uploading web content</td>
<td class="unit">$40.00</td>
<td class="qty">4</td>
<td class="total">$160.00</td>
</tr>
<tr>
<td class="service">Training</td>
<td class="desc">Initial training sessions for staff responsible for uploading web content</td>
<td class="unit">$40.00</td>
<td class="qty">4</td>
<td class="total">$160.00</td>
</tr>
<tr>
<td class="service">Training</td>
<td class="desc">Initial training sessions for staff responsible for uploading web content</td>
<td class="unit">$40.00</td>
<td class="qty">4</td>
<td class="total">$160.00</td>
</tr>
<tr>
<td class="service">Training</td>
<td class="desc">Initial training sessions for staff responsible for uploading web content</td>
<td class="unit">$40.00</td>
<td class="qty">4</td>
<td class="total">$160.00</td>
</tr>
<tr>
<td colspan="4">SUBTOTAL</td>
<td class="total">$5,200.00</td>
</tr>
<tr>
<td colspan="4">TAX 25%</td>
<td class="total">$1,300.00</td>
</tr>
<tr>
<td colspan="4" class="grand total">GRAND TOTAL</td>
<td class="grand total">$6,500.00</td>
</tr>
</tbody>
</table>
<div id="notices">
<div>NOTICE:</div>
<div class="notice">A finance charge of 1.5% will be made on unpaid balances after 30 days.</div>
</div>
</main>';
$header = '<div id="project">
<div><span>PROJECT</span> Website development</div>
<div><span>CLIENT</span> John Doe</div>
<div><span>ADDRESS</span> 796 Silver Harbour, TX 79273, US</div>
<div><span>EMAIL</span> <a href="mailto:[email protected]">[email protected]</a></div>
<div><span>DATE</span> August 17, 2015</div>
<div><span>DUE DATE</span> September 17, 2015</div>
</div>';
$footer = '<div>hhhhhhhhhhhhhhhh</div>';
$mpdf = new mPDF('c', 'A4','0','');
$mpdf->SetHTMLHeader($header);
$mpdf->writeHTML($html,2);
$mpdf->SetFooter($footer);
$mpdf->Output('reporte.pdf', 'I');
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2017-02-10 10:00:47 |
By :
apiwat5656 |
View :
751 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
น่าจะเป็นเพราะ CSS ครับ
|
|
|
|
|
Date :
2017-02-10 11:47:59 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังไม่ได้ เขียนเลย ครับ CSS
|
|
|
|
|
Date :
2017-02-10 11:59:04 |
By :
apiwat5656 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|