New line in FPDF

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

I want all cells to be the same, not change the row. I am trying to search in my code to remove if any code is with ln (). but not find him. I do not know why he is not showing nearby.

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();
+4
source share
1 answer

Your cells have different widths. The first Multicellis the 40second inner cycle80

$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 do not want the LAMPIRAN FOTO\nJAMINANnewline to continue, delete \nfrom it.

Here is a good example with table andMulticells :

+3
source

Source: https://habr.com/ru/post/1658885/


All Articles