3
中有PDF
个不同的表格,使用TCPDF
创建,使用MultiCell
来显示它们。它们位于彼此之上,names
用writeHTML
$html = '<html>
<body>
<p style="line-height: 10%"><h3>CarhireInfo</h3>
</body>
</html>';
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->MultiCell($w=0, $h=0, $cars, $border=0, $align='L', $fill=false, $ln=0, $x='70', $y='74', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);
$pdf->MultiCell($w=0, $h=0, $drivers, $border=0, $align='L', $fill=false, $ln=0, $x='125', $y='70', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);
$pdf->Ln(20);
$html = '<html>
<body>
<p style="line-height: 0"><h3>Manager/-in</h3>
</body>
</html>';
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->MultiCell($w=0, $h=0, $manager, $border=0, $align='L', $fill=false, $ln=0, $x='125', $y='90', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);
$pdf->Ln(20);
$html = '<html>
<body>
<p style="line-height: 0"><h3>Descriptions</h3>
</body>
</html>';
$pdf->writeHTML($html, true, false, true, false, '');
$start_y = $pdf->GetY();
$start_page = $pdf->getPage();
$pdf->MultiCell($w=0, $h=0, $descriptions, $border=0, $align='L', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);
$pdf->lastPage();
$pdf->Output('CarhireInfo.pdf', 'D');
我positioning
tables
设置了x
&amp; y
coordinates
。 PDF
看起来像这样,如果我add
更多的驱动程序,例如:
任何帮助都将不胜感激。
S上。
答案 0 :(得分:-1)
你可以尝试这样的事情
$html = '<html>
<body>
<p style="line-height: 10%"><h3>CarhireInfo</h3>
</body>
</html>';
$pdf->writeHTML($html, true, false, true, false, '');$startX1=$pdf->GetX();$startY1=$pdf->getY();
$pdf->MultiCell($w=0, $h=0, $cars, $border=0, $align='L', $fill=false, $ln=0, $x='70', $y='74', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);$startX2=$pdf->GetX();$startY2=$pdf->getY();
$pdf->MultiCell($w=0, $h=0, $drivers, $border=0, $align='L', $fill=false, $ln=0, $x='125', $y='70', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);$startX3=$pdf->GetX();$startY3=$pdf->getY();
//$pdf->Ln(20);
$html = '<html>
<body>
<p style="line-height: 0"><h3>Manager/-in</h3>
</body>
</html>';
if ($startY1>=$startY2 && $startY1>=$startY3){
$pdf->setY($startY1);
}else if($startY2>=$startY3 && $startY2>=$startY1){
$pdf->setY($startY2);
}else{
$pdf->setY($startY3);
}
$pdf->writeHTML($html, true, false, true, false, '');$startX1=$pdf->GetX();$startY1=$pdf->getY();
$pdf->MultiCell($w=0, $h=0, $manager, $border=0, $align='L', $fill=false, $ln=0, $x='125', $y='90', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);$startX2=$pdf->GetX();$startY2=$pdf->getY();
//$pdf->Ln(20);
$html = '<html>
<body>
<p style="line-height: 0"><h3>Descriptions</h3>
</body>
</html>';
if ($startY1>=$startY2){
$pdf->setY($startY1);
}else{
$pdf->setY($startY2);
}
$pdf->writeHTML($html, true, false, true, false, '');
$start_y = $pdf->GetY();
$start_page = $pdf->getPage();
$pdf->MultiCell($w=0, $h=0, $descriptions, $border=0, $align='L', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0);
$pdf->lastPage();
$pdf->Output('CarhireInfo.pdf', 'D');
希望能帮到你