FPDF prints MultiCell () next

I searched googled and found this question very common, but I can not find the correct and direct answer. I am using FPDF and I want to generate tables using MultiCell (), since I need a line break property. Tried Cell (), but it cannot read line breaks.

$col1="PILOT REMARKS\n\n";
$pdf->MultiCell(189, 10, $col1, 1, 1);
$col2="Pilot Name and Signature\n".$name;
$pdf->MultiCell(63, 10, $col2, 1);
$pdf->Ln(0);
$col3="Date Prepared\n".$date;
$pdf->MultiCell(63, 10, $col3, 1);

But I cannot generate it properly, because MultiCell () summarizes the result. How can I get MultiCell () to print adjacent to each other in the simplest and easiest way?

Found this similar question , but it does not give a clear answer. Any help would be appreciated. Thanks in advance.

+15
source share
4 answers

X Y,

$x = $pdf->GetX();
$y = $pdf->GetY();

$col1="PILOT REMARKS\n\n";
$pdf->MultiCell(189, 10, $col1, 1, 1);

$pdf->SetXY($x + 189, $y);

$col2="Pilot Name and Signature\n".$name;
$pdf->MultiCell(63, 10, $col2, 1);
$pdf->Ln(0);
$col3="Date Prepared\n".$date;
$pdf->MultiCell(63, 10, $col3, 1);
+33

. , SetXY.

:

$x = $this->x;
$y = $this->y;
$push_right = 0;

$this->MultiCell($w = 100,3,"Column\r\nNumber 1",1,'C',1);

$push_right += $w;
$this->SetXY($x + $push_right, $y);

$this->MultiCell($w = 60,3,"Column\r\nNumber 2",1,'C',1);

$push_right += $w;
$this->SetXY($x + $push_right, $y);

$this->MultiCell(0,3,"Column 3\r\nFilling in the Rest",1,'C',1);
+6

You can use the SetXY (x, y) function to set the cursor in pdf.

          $pdf->SetXY(x,y);

Set cursor to print data in pdf

Where x is the value of the x axis and y is the value of the y axis

+2
source

use $pdf->Ln(10); with$pdf->cell();

Example:

$pdf->cell(100,10,"your content");
$pdf->Ln(10);
0
source

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


All Articles