title: TCPDF: Image overlaps html table header after auto-page-break
body: <p>The following code outputs a table with a two lines high table header and a test image in each line. When there's an auto-page-break the image will be printed on the next page correctly, but it will overlap the table header for some pixels (see screenshot). The image position in the next line is correct again. The second table head text is also missing!</p>
  
  <p>The Problem is the multiple line table header. Using one line only fixes the problem, but I need multiple table header rows in my case.</p>
  
  <p><a href="https://i.stack.imgur.com/vljFh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vljFh.jpg" alt="enter image description here"></a></p>
  
  <p>Do you know a workaround to fix this (latest TCPDF 6.2.11)?</p>
  
  <pre><code>$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  
  // 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);
  
  $pdf-&gt;AddPage();
  
  $pdf-&gt;SetFont('helvetica', '', 8);
  
  $tbl = '
          &lt;style&gt;
              th {
                  background-color: #cccccc;
                  font-weight: bold;
              }
          &lt;/style&gt;
  
          &lt;table width="100%" cellpadding="2" cellspacing="0" border="1"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;TH1&lt;/th&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;th&gt;TH2&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;';
  for($i = 0; $i &lt; 10; $i++)
  $tbl .= '   
          &lt;tr&gt;
              &lt;td&gt;&lt;img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/A_butterfly_feeding_on_the_tears_of_a_turtle_in_Ecuador.jpg/320px-A_butterfly_feeding_on_the_tears_of_a_turtle_in_Ecuador.jpg" width="100" height="100"&gt;&lt;/td&gt;
          &lt;/tr&gt;';
  $tbl .='&lt;/table&gt;';
  
  $pdf-&gt;writeHTML($tbl, true, false, false, false, '');
  
  $pdf-&gt;Output('example.pdf', 'I');
  </code></pre>