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.
Asked
Active
Viewed 4,394 times
17
-
for this you can explore wkhtmltopdf that is awesome. – Muhammad Shoaib Dec 17 '13 at 18:08
3 Answers
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
-
i am using this but footer is attached to the end of the content. not at the bottom..... – Muhammad Shoaib Dec 28 '12 at 10:29
-
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.

Rana Touqeer
- 83
- 4