title: SetAutoPageBreak not working or I am not using it correctly
body: <p>SetAutoPageBreak not working or I am not using it correctly. It stops the first page just before the footer but then every page after that just print one line for 39 more pages.What am I doing wrong with this. I can not find anymore information about adding more info to make it work correctly. Here is a link <a href="http://notaryaccounting.com/doc-2.pdf" rel="nofollow">http://notaryaccounting.com/doc-2.pdf</a> to the output file so you can see</p>
  
  <pre><code>class PDF extends tcpdf
  {
  // Page header
      function Header()
      {
          $this-&gt;SetFont('dejavusans', 'BI', 20, '', 'false');
          $this-&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'));
          // Move to the right
          $this-&gt;Ln(5);
          $this-&gt;Cell(60);
          $this-&gt;Cell($w, $h=0, $txt='INCOME REPORT', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0,
              $ignore_min_height=false, $calign='T', $valign='M');
          $this-&gt;Line (0, 13, 210, 13, $style=array());
          // Line break
          $this-&gt;Ln(5);
      }
  // Page footer
      public function Footer() {
          // Position at 15 mm from bottom
          $this-&gt;SetY(-15);
          // Set font
          $this-&gt;SetFont('helvetica', 'I', 8);
          // Page number
          $this-&gt;Cell(0, 10, 'Page '.$this-&gt;getAliasNumPage().'/'.$this-&gt;getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
      }
  
  }
  $pdf = new PDF();
  $pdf-&gt;AddPage();
  
  $pdf-&gt;SetAutoPageBreak(TRUE,20);
  $pdf-&gt;SetFont('arial','B',12);
  
  $y_axis = 20;
  //Set Row Height
  $row_height = 6;
  //Go to next row
  $y_axis = $y_axis + $row_height;
  //initialize counter
  $pageLine = 0;
  //Set maximum rows per page
  $itemsPerPage = 5;
  
  $result = $db-&gt;query("Select
    customers.name,
    signings1.signstart,
    signings1.fname,
    signings1.lname,
    signings1.city,
    signings1.state,
    signings1.samount,
    signings1.prtamount,
    signings1.faxamount
  From
    customers Inner Join
    signings1 On customers.custid = signings1.custid
  Where
    signings1.pid = 6 And
    signings1.done = 1
  Order By
    customers.name ,
    signings1.signstart ");
  $current=null;
  foreach($result as $key =&gt; $income) {
  
  
      if($current!=$income['name']){
  
          $pdf-&gt;SetY($y_axis);
          $pdf-&gt;SetFillColor(0,68,150);
          $pdf-&gt;SetTextColor (252,252,252);
          $pdf-&gt;SetX(05);
          $pdf-&gt;Cell(200,6,'Customer:' . '               ' . $income['name'] ,1,0,'L',1);
  
          //print column titles for the current page
          $y_axis = $y_axis + 6;
          $pdf-&gt;SetY($y_axis);
          $pdf-&gt;SetFillColor(0,68,120);
          $pdf-&gt;SetTextColor (252,252,252);
          $pdf-&gt;SetX(05);
          $pdf-&gt;Cell(30,6,'Date:',1,0,'L',1);
          $pdf-&gt;Cell(70,6,'Name:',1,0,'L',1);
          $pdf-&gt;Cell(70,6,'Location:',1,0,'L',1);
          $pdf-&gt;Cell(30,6,'Amount:',1,0,'L',1);
          $current = $income['name'];
  
  
   }
      $y_axis = $y_axis + $row_height;
      $pdf-&gt;SetY($y_axis);
      $pdf-&gt;SetX(05);
      $pdf-&gt;SetTextColor (0,0,0);
      $total = $income['samount'] + $income['prtamount'] + $income['faxamount'];
      $name = $income['fname'] . ' ' .$income['lname'];
      $signdate=phpdate($income['signstart']);
      $pdf-&gt;Cell(30,6,$signdate,1,0,'L',0);
      //$pdf-&gt;Cell(10,6,$income['custid'],1,0,'L',0);
      $pdf-&gt;Cell(70,6,$name,1,0,'L',0);
      $pdf-&gt;Cell(70,6,$income['city'],1,0,'L',0);
      $pdf-&gt;Cell(30,6,$total,1,0,'L',0);
  
  } 
  
  $pdf-&gt;Output();
  </code></pre>