Prashant Bhatt
Prashant Bhatt

Reputation: 79

how use mutiline in fpdf

my php file to create pdf file like this with this code i want to use righ side of my page also i want to print that data in right side of my page how it is possible

<?php
include ('config.php');
require ('fpdf/fpdf.php');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('times','',8);
$sql = "SELECT address,user_id FROM `address`
         JOIN contact ON contact.contact_id = address.contact_id";
$result = mysql_query($sql);

while($rows=mysql_fetch_array($result))
{
    $pdf->Cell(20,3,'Name : ');
    $user_id = $rows['user_id'];
    $string = str_replace(' ', '', $user_id);
    $pdf->MultiCell(64,3, $string,0); 
    $pdf->Cell(20,3,'Address :'); 
    $address = $rows['address'];
    $address = str_replace(' ', '', $address);
    $pdf->MultiCell(64,3, $address,0);
    $pdf->Ln(); 
}
$pdf->Output();
?>

Upvotes: 0

Views: 251

Answers (1)

Alpesh Rathod
Alpesh Rathod

Reputation: 385

$pdf->MultiCell( 200, 40, $reportSubtitle, 1);

The MultiCell is used for print text with multiple lines. It has the same atributes of Cell except for ln and link.

You can read the full document here..

http://www.fpdf.org/en/doc/multicell.htm

Upvotes: 1

Related Questions