简体   繁体   English

TCPDF中的自定义HTML页脚

[英]Custom HTML footer in TCPDF

I am trying to create a letter template in TCPDF but struggling with the footer. 我正在尝试在TCPDF中创建信函模板,但是却在页脚中苦苦挣扎。

I have added the below 我添加了以下内容

$footertext="Registered Charity no XXX. Company Limited by Guarantee registered in England and Wales no XXX. <br>
Registered Office: ADDRESS HERE";

And then added the below in the PDF create section 然后在PDF创建部分中添加以下内容

public function Footer() {
        // Position at 15 mm from bottom
        $this->SetY(-15);
        // Set font
        $this->SetFont('helvetica', '', 8);
        // Page number
        $this->writeHTML($footertext, false, true, false, true);   
    }

However nothing shows? 但是什么都没显示?

You have to create an instance of fPDF before creating your footer function. 创建footer函数之前,您必须创建fPDF的实例。

require('fpdf.php');
class PDF extends FPDF {
    //
    // This class extends FPDF so we may customize the header and footer
    // of the PDFs that are created
    //

    function Footer() {
        $this->SetFont('helvetica', '', 8);
        // Page number
        $this->writeHTML($footertext, false, true, false, true);   
    }  // end of the Footer function
}  // end of the PDF class

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM