17

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.

Muhammad Shoaib
  • 745
  • 5
  • 23

3 Answers3

8

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');
}
Victor9663
  • 200
  • 1
  • 10
2

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.

Skynet
  • 558
  • 3
  • 16
2

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.