Thursday, 5 September 2013

FPDF: align cell with multicell

FPDF: align cell with multicell

I am trying to align a cell which contains image with a multicell which
contains details related to the image such that both the image and details
would display side by side. After searching the web, I found some method
to do that. (I called the details out from database):
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$image_height = 37;
$image_width = 37;
foreach($inventories as $key => $inventories) :
$image = $inventories['image'];
$resourceID = $inventories['resourceID'];
$learningcentre = $inventories['learningcentre'];
$title = $inventories['title'];
$quantity = $inventories['quantity'];
$description = $inventories['description'];
$pdf->Cell( 40, 20, $pdf->Image($imagesDirectory.$image, $pdf->GetX(),
$pdf->GetY(), $image_height, $image_width), 0, 0, 'L');
$pdf->MultiCell(140,8,$resourceID."\n".$title."\n".$learningcentre."\n".$quantity."\n".$description,
1,1);
$pdf->Ln();
endforeach;
However, when the result reaches the end of the page, the image would get
cut off and the details cell would be pushed to the next page as shown on
the picture below
http://i.imgur.com/HvBWMUF.png
I am new to FPDF and have been trying to search for a solution but to no
avail. Any help would be appreciated.Thanks!

No comments:

Post a Comment