title: FPDF Page Break Question
body: <p>I am using PHP and FPDF to generate a PDF with a list of items.  My problem is if the item list goes on to a second or third page, I want to keep the Item Name, Quantity and Description together.  Right now, it will go to a second page, but it may split up all of the details for a particular item.  PLEASE HELP!</p>
  
  <pre><code>&lt;?php
  require_once('auth.php');      
  require_once('config.php');   
  require_once('connect.php');  
  
  $sqlitems="SELECT * FROM $tbl_items WHERE username = '" . $_SESSION['SESS_LOGIN'] . "'";
  $resultitems=mysql_query($sqlitems);
  
  require_once('pdf/fpdf.php');
  require_once('pdf/fpdi.php');
  
  
  $pdf =&amp; new FPDI();
  $pdf-&gt;AddPage('P', 'Letter');    
  $pdf-&gt;setSourceFile('pdf/files/healthform/meds.pdf'); 
  $tplIdx = $pdf-&gt;importPage(1);
  $pdf-&gt;useTemplate($tplIdx);
  
  $pdf-&gt;SetAutoPageBreak(on, 30);
  
  $pdf-&gt;SetTextColor(0,0,0);
  $pdf-&gt;Ln(10);
  
  while($rowsitems=mysql_fetch_array($resultitems)){
  
  $pdf-&gt;SetFont('Arial','B',10);
  $pdf-&gt;Cell(50,4,'Item Name:',0,0,'L');
  $pdf-&gt;SetFont('');
  $pdf-&gt;Cell(100,4,$rowsitems['itemname'],0,0,'L');  
  
  $pdf-&gt;SetFont('Arial','B',10);
  $pdf-&gt;Cell(50,4,'Quantity:',0,0,'L');
  $pdf-&gt;SetFont('');
  $pdf-&gt;Cell(140,4,$rowsitems['itemqty'],0,1,'L');
  
  $pdf-&gt;SetFont('Arial','B');
  $pdf-&gt;Cell(50,4,'Description:',0,0,'L');
  $pdf-&gt;SetFont('');
  $pdf-&gt;Cell(140,4,$rowsitems['itemdesc'],0,1,'L');
  }
  
  $pdf-&gt;Output('Items.pdf', 'I');
  
  ?&gt;
  </code></pre>