在回显产品列表(通常是多页)之后,下面的内容会重叠到第一页。我一直试图解决这个问题表格,所以很多都没有运气所以。我已经在堆栈上看到了一些关于流量的话题但是并没有#39为我工作。以下是显示上述问题的完整工作代码。我怎么能解决这个问题。非常感谢完全解决方案。
$InvAllPrct = '';
$InvAllPrct .= '<div><br>
<table border="0" cellpadding="3" style="width:100%">
<tbody>
<tr style="font-weight: bold;">
<th style="width: 6%;">Product</th>
<th style="width: 6%;">Price</th>
<th style="width: 4%;">QTY</th>
<th style="width: 7%;">Total</th>
</tr><hr>';
//----------------------get prct information-----------------------------------------------
for($i=0;$i<100;$i++){
$InvAllPrct .= '<tr>
<td style="text-align: right;">Some text</td>
<td style="text-align: right;">100</td>
<td style="text-align: right;">1</td>
<td style="text-align: right;">100</td>
</tr>';
}
$InvAllPrct .= '</tbody>
</table>
<hr style="font-weight:bold;">
</div>';
$Cname = '';
$Cname .= '<div style="float:right;">';
$Cname .= '<span style="font-weight: 600;font-style: oblique;font-size: 12px;">Some company name</span><br>';
$Cname .= '<span> some text</span><br>';
$Cname .= '</div>';
//---------------------------tax n total---------------------------------------------
$GrandTotalData = '';
$GrandTotalData .= '
<span>Sub Total: 100</span><br>';
$GrandTotalData .= '<span> tax1 : 10%</span><br>';
$GrandTotalData .= '<span> tax2 : 10%</span><br>';
$GrandTotalData .= '<span>Total : 200</span><br>';
$GrandTotalData .= '<span style=" font-weight: bold;">Grand Total : 200<hr></<span>';
// Include the main TCPDF library (search for installation path).
require('tcpdf1/tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set font
$pdf->SetFont('dejavusans', '', 10);
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
// add a page
$pdf->AddPage();
$pdf->MultiCell(00, 00, "Some text", 0, 'C', 0, 0, '', '', true, 0, false, true, 40, 'T');
$pdf->SetFont('dejavusans', '', 7);
// create some HTML content
$y = $pdf->getY();
$pdf->writeHTMLCell('', '', '46', $y,"Some Name", 0, 0, 0, true, 'J', false);
$y = $pdf->getLastH()+$y;
$pdf->writeHTMLCell('', '', 10, $y, $InvAllPrct, 0, 0, 0, true, 'J', true);
$y = $pdf->getLastH()+$y;
// // ******Problem Starts here overlapping on above content on first page***************
$pdf->writeHTMLCell('38', '', 160, $y, $GrandTotalData, 0, 0, 0, true, 'J', true);
$html = '<div style="text-align:centre;"> Some Text......................................</div>';
$y = $pdf->getLastH()+$y;
$pdf->writeHTMLCell('', '', '', $y, $html, 0, 0, 0, true, 'J', true);
$y = $pdf->getLastH()+$y;
$html = '<div style="text-align: justify;margin: 0px 225px 17px 5px;">Some long text here.................</div><br>
<div style="text-align: justify;margin: 0px 225px 36px 5px;">Some long text here.....................</div>
';
$pdf->writeHTMLCell('144', '', '', $y, $html, 0, 0, 0, true, 'J', true);
$pdf->lastPage();
$pdf->Output('example_006.pdf', 'I');
php tcpdf