FPDF print MultiCell() adjacently

烈酒焚心 提交于 2019-11-27 21:18:43

Try storing the X and Y co-ordinates and then setting them after the write

$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's 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);
mpickens

Just to add to Danny's answer. I like keeping the Width of each column stored and then use that when executing the SetXY method.

Example:

$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);

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

          $pdf->SetXY(x,y);

Set cursor to print data in pdf

Where x is x-axis value and y is y-axis value

user3035129

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

Example:

$pdf->cell(100,10,"your content");
$pdf->Ln(10);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!