Add main header on first page only in TCPDF
You can check examples of tcpdf and you can inherit TCPDF class and use that class:
class YOUR_CLASS extends TCPDF { /** * Overwrite Header() method. * @public */ public function Header() { // if ($this->tocpage) or if ($this->page == 1) { // *** replace the following parent::Header() with your code for TOC/page you want page // parent::Header(); // this will add logo and text to first page $this->Image('http://localhost/first_page_logo.png', 10, 10, 15, '', 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false); $this->SetFont('helvetica', 'B', 14); $this->Cell(0, 15, 'First page header text', 0, false, 'C', 0, '', 0, false, 'M', 'M'); } else { // *** replace the following parent::Header() with your code for other pages //parent::Header(); // following will add your own logo ant text to other pages $this->Image('http://localhost/other_pages_logo.png', 10, 10, 15, '', 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false); $this->SetFont('helvetica', 'B', 14); $this->Cell(0, 15, 'Other pages header text', 0, false, 'C', 0, '', 0, false, 'M', 'M'); } }} // end of class
and than remove:
$obj_pdf = new TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
with:
$obj_pdf = new YOUR_CLASS('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);