title: In codeigniter how to get tcpdf custom header and footer
body: <p>My controller to generate pdf is as folloe</p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  class C_test extends CI_Controller {
  
      function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;library("Pdf");    
      }
      public function create_pdf() {
      $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);    
      $pdf-&gt;SetCreator(PDF_CREATOR);
      $pdf-&gt;SetAuthor('Vijay Kumar');
      $pdf-&gt;SetTitle('TCPDF Example 001');
      $pdf-&gt;SetSubject('TCPDF Tutorial');
      $pdf-&gt;SetKeywords('TCPDF, PDF, example, test, guide');   
       set default header data
     $pdf-&gt;SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
  
      $pdf-&gt;setFooterData(array(0,64,0), array(0,64,128)); 
  
      // set header and footer fonts
      $pdf-&gt;setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
      $pdf-&gt;setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));  
  
      // set default monospaced font
      $pdf-&gt;SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); 
  
      // set margins
      $pdf-&gt;SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
      $pdf-&gt;SetHeaderMargin(PDF_MARGIN_HEADER);
      $pdf-&gt;SetFooterMargin(PDF_MARGIN_FOOTER);    
  
      // set auto page breaks
      $pdf-&gt;SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); 
  
      // set image scale factor
      $pdf-&gt;setImageScale(PDF_IMAGE_SCALE_RATIO);  
  
      // set some language-dependent strings (optional)
      if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
          require_once(dirname(__FILE__).'/lang/eng.php');
          $pdf-&gt;setLanguageArray($l);
      }   
      // set default font subsetting mode
      $pdf-&gt;setFontSubsetting(true);   
      $pdf-&gt;SetFont('dejavusans', '', 14, '', true);   
      $pdf-&gt;AddPage(); 
  
      // set text shadow effect
      $pdf-&gt;setTextShadow(array('enabled'=&gt;true, 'depth_w'=&gt;0.2, 'depth_h'=&gt;0.2, 'color'=&gt;array(196,196,196), 'opacity'=&gt;1, 'blend_mode'=&gt;'Normal'));    
  
      // Set some content to print
      $html = &lt;&lt;&lt;EOD
      &lt;h1&gt;Welcome to  pdf gen&lt;/h1&gt;
  EOD;
  
      // Print text using writeHTMLCell()
      $pdf-&gt;writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);  
      $pdf-&gt;Output('example_001.pdf', 'I');    
  
      }
  }
  </code></pre>
  
  <p>pdf.php library</p>
  
  <pre><code>&lt;?php 
  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  require_once dirname(__FILE__) . '/tcpdf/tcpdf.php';
  
  class Pdf extends TCPDF
  {
   function __construct()
   {
   parent::__construct();
   }
  }
  </code></pre>
  
  <p>I want to generate a pdf with custom header and footer, header is image and footer is dynamic name and need page number</p>
  
  <p>In controller how to do this to work with custom pdf header and footer</p>