TCPDF Multiple Footers

荒凉一梦 提交于 2019-12-11 22:22:08

问题


I am using TCPDF to generate PDF documents. The problem I have is that I am trying to add a different footer per page. Apparently, TCPDF provides a solution only for a single footer.

Each footer contains only basic html code without any styling.

Any ideas?


回答1:


You can turn of the default footer like this:

$pdf->SetPrintFooter(false);

create your own one like this:

$footer = 'yau man footer stuff';

and then create your own footer function:

public function _footer($input) {
    $text = $input;

    $pdf->setY(-15); // or whatever location your footer should be displayed.

    $pdf->Cell ( // or another method like Write(), WriteHTML() ..
        $width = 0, // width of the cell, not the input
        $height = 0, // height of the cell..
        $x,
        $y,
        $text = '', // your input.
        $border = 0,
        $ln = 0,
        $fill = false,
        $reseth = true,
        $align = '',
        $autopadding = true 
    );
}

by calling $pdf->_footer($footer); you create your own footer



来源:https://stackoverflow.com/questions/26658186/tcpdf-multiple-footers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!