title: line height auto adjust in fpdf multicell ()
body: <p>I am using fpdf to create pdf from data in MySql table dynamically. And I am printing it using MultiCell() function. My Problem is I want it to auto adjust the line height of the text. I have read the documentation at the site but it only tells about auto adjust width. But I could not find any solution for line height auto adjust. Is there any way to do so. What may be the alternate ways? Please help. Here is the piece of the code. :-</p>
  
  <pre><code>&lt;?php session_start();
  
  include 'conn.php';
  $table=$_SESSION["name"];
  $testid=$_SESSION["id"];
  $stuid=$_SESSION["stuid"];
  $ans=$_SESSION["score1"];
  
  //pdf creation
  require('../fpdf/fpdf.php');
  
  class PDF extends FPDF
  {
  function Header()
  {
  global $title;
  $this-&gt;Image('../fpdf/logo.JPG',10,10,200);
  // Arial bold 15
  $this-&gt;SetFont('Arial','B',15);
  // Calculate width of title and position
  $w = $this-&gt;GetStringWidth($title)+6;
  $this-&gt;SetX((210-$w)/2);
  // Colors of frame, background and text
  
  // Thickness of frame (1 mm)
  $this-&gt;SetLineWidth(1);
  // Title
  // Line break
  $this-&gt;Ln(20);
  }
  
  function Footer()
  {
  // Position at 1.5 cm from bottom
  $this-&gt;SetY(-15);
  // Arial italic 8
  $this-&gt;SetFont('Arial','I',8);
  // Text color in gray
  $this-&gt;SetTextColor(128);
  // Page number
  $this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo(),0,0,'C');
  }
  
  function ChapterTitle($num, $label)
  {
  // Arial 12
  $this-&gt;SetFont('Arial','',12);
  // Background color
  $this-&gt;SetFillColor(200,220,255);
  // Title
  $this-&gt;Cell(0,6,"Chapter $num : $label",0,1,'L',true);
  // Line break
  $this-&gt;Ln(4);
  }
  
  function ChapterBody($file)
  {
  // Read text file
  $txt = file_get_contents($file);
  // Times 12
  $this-&gt;SetFont('Times','',12);
  // Output justified text
  $this-&gt;MultiCell(0,5,$txt);
  // Line break
  $this-&gt;Ln();
  // Mention in italics
  $this-&gt;SetFont('','I');
  $this-&gt;Cell(0,5,'(end of excerpt)');
  }
  
  function PrintChapter($num, $title, $file)
  {
  $this-&gt;AddPage();
  $this-&gt;ChapterTitle($num,$title);
  $this-&gt;ChapterBody($file);
  }
  }
  
  $pdf = new PDF();
  $pdf-&gt;SetAuthor('OSP Classes');
  $pdf-&gt;AddPage();
  $x=1;
  $i=0;
  $sql1=mysql_query("select * from $table") or die (mysql_error());
  while($result1=mysql_fetch_row($sql1))
  {
  $pdf-&gt;SetFont('Arial','B',14);
  $pdf-&gt;MultiCell(0,10,'Ques No.'.$x .'.'. $result1[1]);
  $pdf-&gt;Ln(10);
  $pdf-&gt;SetFont('Arial','',14);
  $pdf -&gt;MultiCell(0,0,'Ans 1.'. $result1[2]);
  $pdf-&gt;Ln(10);
  $pdf-&gt;SetFont('Arial','',14);
  $pdf -&gt;MultiCell(0,0,'Ans 2.'. $result1[3]);
  $pdf-&gt;Ln(10);
  $pdf-&gt;SetFont('Arial','',14);
  $pdf -&gt;MultiCell(0,0,'Ans 3.'. $result1[4]);
  $pdf-&gt;Ln(10);
  $pdf-&gt;SetFont('Arial','',14);
  $pdf -&gt;MultiCell(0,0,'Ans 4.'. $result1[5]);
  $pdf-&gt;Ln(10);
  $pdf-&gt;MultiCell(0,0,'Right Ans . '. $result1[6].'           '.'Your Ans . '. $ans[$i]);
  $pdf-&gt;Ln(20);
  $x++;
  $i++;
  }
  $pdf-&gt;Output();
  ?&gt;
  </code></pre>