3

I am using PDO for connection database. this is output from my code: enter image description here

I want all cell same line, not change line. i try search in my code to delete if any code with ln(). but not find it. i don't know why it not show beside.

this is my code:

$stmt->execute(array('idFotoJaminan'=>$idFotoJaminan));
$result = $stmt->fetchALL(PDO::FETCH_ASSOC);


//$pdf->Cell(40,10,'LAMPIRAN FOTO\nJAMINAN',1,1,'C');
$pdf->Multicell(40,4,"LAMPIRAN FOTO\nJAMINAN",1,"C");

foreach($result as $row) {
$pdf->Multicell(80,4,'Debitur : '. $row['debitur'],1); 
//$pdf->Ln();
//$pdf->Cell(0,5,'L NAME:', $row['lname']);
$pdf->Cell(0,5,'L NAME:'. $row['debitur'], 0, 0, 'L'); 
//$pdf->Ln();
}
$pdf->Output();
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345

1 Answers1

4

Your cells are with different width. First Multicell is 40 second one inside loop is 80

$pdf->Multicell(40,4,"LAMPIRAN FOTO\nJAMINAN",1,"C");
...
$pdf->Multicell(80,4,'Debitur : '. $row['debitur'],1);

Try to make them equal

$pdf->Multicell(80,4,"LAMPIRAN FOTO\nJAMINAN",1,"C");
...
$pdf->Multicell(80,4,'Debitur : '. $row['debitur'],1);

Then if you don't want LAMPIRAN FOTO\nJAMINAN to go on new line remove \n from it.

Here is good example with table and Multicells:

S.I.
  • 3,250
  • 12
  • 48
  • 77