php - Not able to set proper data position in FPDF -
scenario:
i fetching data database , it's printing data in fpdf in loop.
problem:
i facing problem printing data in loop in left side of page. has set data when tried put data on left side of page, automatically skips line on right side of page.
question:
i not know why happened; maybe there problem setting position of x
, y
.
the following code:
<?php include ('config.php'); require ('fpdf/fpdf.php'); $pdf=new fpdf(); $pdf->addpage(); $pdf->setfont('times','',8); $sql = "select address,user_id contact left join address on address.contact_id = contact.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 -> setx(110); $pdf->cell(20,3,'name : '); $user_id = $rows['user_id']; $string = str_replace(' ', '', $user_id); $pdf->multicell(64,3, $string,0); $pdf->cell(20,2,'address :'); $address = $rows['address']; $address = str_replace(' ', '', $address); $pdf->multicell(64,3, $address,0); $pdf -> setx(110); $pdf->cell(20,2,'address : '); $address = $rows['address']; $address = str_replace(' ', '', $address); $pdf->multicell(64,3, $address,0); $pdf->ln(); } $pdf->output(); ?>
where i've issue set data position. ideas?
try this
$user_id = $rows['user_id']; $string = str_replace(' ', '', $user_id); $pdf->multicell(64,3, $string,0); ...... $myx = $pdf->getx(); $myy = $pdf->gety(); $pdf->sety($myy); $pdf->setx($myx); .... pdf->cell(20,3,'name : '); $user_id = $rows['user_id']; $string = str_replace(' ', '', $user_id);
Comments
Post a Comment