Attach footer at very bottom to every page in tcpd

2019-06-15 00:34发布

I need to attach footer at the very bottom of every page. I am using tcpdf for generating pdf's. i tried many solution on google but did not found any luck. My current framework is yii and i am using tcpdf extension.

标签: yii tcpdf
3条回答
SAY GOODBYE
2楼-- · 2019-06-15 00:50

Well, if you're subclassing the tcpdf class, just add a public function Footer() in which you do your stuff. It might help to set the bottom page margin to a sensible value before doing the content work, so that the Footer function has "space" to put in the footer.

查看更多
Animai°情兽
3楼-- · 2019-06-15 00:55

why don't you try mpdf extension i am not sure if you can get its library for yii but it has one for codeigniter and it is awesome converts css + Html to pdf accurately.

查看更多
爷、活的狠高调
4楼-- · 2019-06-15 01:11

you need to write Footer method in your class for example

// Page footer
public function Footer() {
    // Position at 15 mm from bottom
    $this->SetY(-15);
    // Set font
    $this->SetFont('helvetica', 'I', 8);
    // Page number
    $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
查看更多
登录 后发表回答