[英]FPDF: align cell with multicell
我试图将包含图像的单元格与包含与图像相关的细节的多单元格对齐,以使图像和细节都可以并排显示。 在网上搜索后,我发现了一些方法。 (我从数据库中调用了详细信息):
$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;
但是,当结果到达页面末尾时,图像将被剪切,并且细节单元格将被推送到下一页,如下图所示
我是FPDF的新手,一直在尝试寻找解决方案,但无济于事。 任何帮助将不胜感激。谢谢!
我本人是FPDF新手,但是您是否尝试过AcceptPageBreak函数?
像这样(从fpdf网站复制):
function AcceptPageBreak()
{
// Method accepting or not automatic page break
if($this->col<2)
{
// Go to next column
$this->SetCol($this->col+1);
// Set ordinate to top
$this->SetY($this->y0);
// Keep on page
return false;
}
else
{
// Go back to first column
$this->SetCol(0);
// Page break
return true;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.