title: Generate PDF pages with TCPDF and PHP
body: <p>I am trying to generate a pdf doc of certificates. The list is from a form post. With straight php, no tcpdf code, it generates each certificate. When I add the tcpdf code it only generates 1 certificate.
  Thanks</p>
  
  <pre><code>// set font
  $pdf-&gt;SetFont('times', '', 20);
  // add a page
  $pdf-&gt;AddPage();
  
  // LOOP
      while ($rowPart = mysql_fetch_array($result)) 
          {
      $PartName = ucfirst(strtolower($rowPart['firstname'])) . " " . ucfirst(strtolower($rowPart['lastname']));
  // PDF STARTS HERE**************************
      $pdf-&gt;SetTextColor(255, 0, 0);
      $pdf-&gt;SetFont('alexbrush', '', 35);
      $pdf-&gt;SetY( 67);
      $pdf-&gt;Cell(0, 0, $PartName, 0, 0, 'C', 0, '', 3);
      $pdf-&gt;SetFont('helveticaB', '', 15);
      $pdf-&gt;SetY( 127);
      $pdf-&gt;Cell(0, 0, $SemDesc, 0, 1, 'C', 0, '', 3);
      $pdf-&gt;SetY( 135);
      $pdf-&gt;Cell(0, 0, $SemName, 0, 1, 'C', 0, '', 3);
      $pdf-&gt;Ln();
          }
  // LOOP ENDS HERE**************************
  
  //Close and output PDF document
  $pdf-&gt;Output('certificate.php', 'I');
  </code></pre>