0

KIndly share the customization procedure tcpdf header section and footer section?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Dhiju
  • 1
  • 1
  • 2

2 Answers2

3

Set Header .

$PDF_HEADER_LOGO = "logo.png";//any image file. check correct path.
$PDF_HEADER_LOGO_WIDTH = "20";
$PDF_HEADER_TITLE = "This is my Title";
$PDF_HEADER_STRING = "Tel 1234567896 Fax 987654321\n"
. "E abc@gmail.com\n"
. "www.abc.com";
$pdf->SetHeaderData($PDF_HEADER_LOGO, $PDF_HEADER_LOGO_WIDTH, $PDF_HEADER_TITLE, $PDF_HEADER_STRING);

Set Footer .
Open tcpdf.php file and search the "public function Footer()" Now in this function see the last else condition, and you can add your code there
E.g

$this->SetX($this->original_lMargin);
$footer_data="Abc Company Pvt Ltd XYZ 20 000 111 222 USA credit Licence Number 000000";
$this->Cell(0, 0, $this->getAliasRightShift().$footer_data, 'T', 0, 'L');
$this->Cell(0, 0, $this->getAliasRightShift().$pagenumtxt, 'T', 0, 'R');
vijay
  • 731
  • 5
  • 15
1

Partially covered by: https://stackoverflow.com/a/12672014/279262

You can customise header/footer in such a way:

class MyTCPDF extends TCPDF
{
   public function Header()
   {
      // Customised header
   }
   public function Footer()
   {
      // Customised footer
   }
}
Community
  • 1
  • 1
Alberto Arena
  • 344
  • 3
  • 12