title: TCPDF - How to display tableheaders on each page of table data?
body: <p>All,</p>
  
  <p>I am trying to render a table with pages and pages of data. The rendering fails utterly from the second page onwards. Also, how can I make sure the table that extends over pages and pages has tableheaders on each and every page?</p>
  
  <p>This is the function I am using so far, but it doesn't seem to work very nicely from second page onwards:</p>
  
  <p>Thanks</p>
  
  <pre><code>// Colored table
  public function ColoredTable($header,$data) {
      // Colors, line width and bold font
      $this-&gt;SetFillColor(170,195,255);
      $this-&gt;SetTextColor(0);
      $this-&gt;SetDrawColor(205, 205, 205);
      $this-&gt;SetLineWidth(0.3);
      $this-&gt;SetFont('helvetica', 'B');
      // Header
      $w = array(35, 35, 20, 20, 20, 10, 20, 8, 20);
      $num_headers = count($header);
      for($i = 0; $i &lt; $num_headers; ++$i) {
          $this-&gt;Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1);
      }
      $this-&gt;Ln();
      // Color and font restoration
      $this-&gt;SetFillColor(225, 229, 233);
      $this-&gt;SetTextColor(0);
      $this-&gt;SetFont('helvetica','','10');
      // Data
      $fill = 0;
      foreach($data as $row) {
  
          $this-&gt;MultiCell($w[0], 8, $row[0], 1, 'L', $fill, 0, '', '', true, 0, false, true, 8, 'M', true);
          $this-&gt;MultiCell($w[1], 8, $row[1], 1, 'L', $fill, 0, '', '', true, 0, false, true, 8, 'M', true);
          $this-&gt;MultiCell($w[2], 5, $row[2], 1, 'L', $fill, 0, '', '', true, 0, false, true, 10, 'M', true);
          $this-&gt;MultiCell($w[3], 5, $row[3], 1, 'L', $fill, 0, '', '', true, 0, false, true, 10, 'M', true);
          $this-&gt;MultiCell($w[4], 8, $row[4], 1, 'L', $fill, 0, '', '', true, 0, false, true, 8, 'M', true);
          $this-&gt;MultiCell($w[5], 5, $row[5], 1, 'L', $fill, 0, '', '', true, 0, false, true, 10, 'M', true);
          $this-&gt;MultiCell($w[6], 8, $row[6], 1, 'L', $fill, 0, '', '', true, 0, false, true, 8, 'M', true);
          $this-&gt;MultiCell($w[7], 5, $row[7], 1, 'L', $fill, 0, '', '', true, 0, false, true, 10, 'M', true);
          $this-&gt;MultiCell($w[8], 8, $row[8], 1, 'L', $fill, 0, '', '', true, 0, false, true, 8, 'M', true);
          $this-&gt;Ln();
          $fill=!$fill;
      }
      $this-&gt;Cell(array_sum($w), 0, '', 'T');
  }
  </code></pre>