[英]create custom html footer inn tcpdf
I would like to create an html footer with tcpdf.我想用 tcpdf 创建一个 html 页脚。 I found this documentation to create a custom footer: https://tcpdf.org/examples/example_003/我发现此文档用于创建自定义页脚: https://tcpdf.org/examples/example_003/
But I have no idea how I can realize it with this html content:但我不知道如何用这个 html 内容来实现它:
<table class="tblFooter" cellpadding="5">
<tr>
<td>
Box 1
</td>
<td>
Box2
</td>
<td>
Box3
</td>
</tr>
</table>
Can you help me please?你能帮我吗? Thank you very much:)非常感谢你:)
You have to extend the TCPDF class to add custom Header-Footer.您必须扩展 TCPDF class 以添加自定义页眉页脚。 Providing an example for your reference.提供示例供您参考。
class MYPDF extends TCPDF {
public function Header() {
$hdrhtml ='
<br /><br />
<table border="0" width="650" cellspacing="1">
<tr>
<td align="center">
<br />
<font style="font-size: 10px;"><b>Some text<br /></b></font>
<font style="font-size: 10px;">Some Text</font>
</td>
</tr>
</table>
';
$this->writeHTML($hdrhtml, true, false, true, false, '');
}
public function Footer() {
$fhtml = '
<table class="tblFooter" cellpadding="5">
<tr>
<td>
Box 1
</td>
<td>
Box2
</td>
<td>
Box3
</td>
</tr>
</table>
';
$this->writeHTML($fhtml, true, false, true, false, '');
}
}
$pdf = new MYPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins, left-top-right
$pdf->SetMargins(20, 10, 10);
// remove default header/footer
//$pdf->setPrintHeader(false);
//$pdf->setPrintFooter(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 50);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.