I would like to make a dynamic footer containing data taken from a database. How to extend TCPDF class to put those data in?
// my DB stuff here
$datafromdb = getDataFromDB();
class MYPDF extends TCPDF {
// Page footer
public function Footer() {
// Position at 10 mm from bottom
$this->SetY(-10);
// Set font
$this->SetFont('dejavusans', 'I', 8);
$foot = $datafromdb.'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages();
$this->MultiCell(0, 10, $foot, 0, 'C');
}
}
you can add a __construct method to pass your data.
try this :