tcpdf edit footer

lv949 picture lv949 · May 13, 2010 · Viewed 35.9k times · Source

How do I edit a footer using tcpdf? I want to add current date & time at the footer. Please help.

Answer

Oli picture Oli · Jan 18, 2012

Override the class like this :

class MYPDF extends TCPDF {
    public function Footer() {
        $image_file = "img/bg_bottom_releve.jpg";
        $this->Image($image_file, 11, 241, 189, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);

        $this->SetY(-15);
        $this->SetFont('helvetica', 'N', 6);
        $this->Cell(0, 5, date("m/d/Y H\hi:s"), 0, false, 'C', 0, '', 0, false, 'T', 'M');
    }
}

then instead of calling :

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

do :

$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);