Debanjan Roy
Debanjan Roy

Reputation: 17

Cell is not placed beside the Multicell

I am creating a invoice in pdf format using fpdf in php. My requirements is to create a comment box using multicell(), and beside of the comments, I want to show grand total of the bill using cell(). But in the output the cell is showing below of the multicell instead placed in beside of the multicell.

My code is:

$pdf->SetFillColor(204,204,204);        //for filling grey color
$pdf->cell(105,5,'Comments',1,1,'',true);  //header of the comment box
$pdf->MultiCell(105,30,'abcd',1,'');     //content of the comment box
$pdf->cell(5,5,'Grand Total',1,1,'C');   //show grand total of the bill

Am I clear? If not comment it, I will describe.

Upvotes: 0

Views: 319

Answers (1)

Ashutosh
Ashutosh

Reputation: 624

You have to set your X-coordinate for the next cell like this:-

$current_y = $pdf->GetY();
$current_x = $pdf->GetX();
$pdf->MultiCell(105,5,'value',1,'T', false,'T');
$pdf->SetXY($current_x + 100, $current_y);
<next-cell>

And you get next cell just after MultiCell. Hope it will work for you...

Upvotes: 1

Related Questions