【发布时间】:2018-04-04 00:02:29
【问题描述】:
对于有限的表格记录 pdf 看起来不错。
“echo $html”中的所有表格记录看起来都不错,但是在创建 pdf 后,当表格记录达到最大值时,分页符不起作用。它会在最多记录期间创建前 4-5 页空白。
最大表记录期间的codeigniter dompdf分页问题:
我的代码sn-p:
//控制器代码
function pdf_create($html, $filename='', $stream=TRUE)
{
require_once("dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
if ($stream) {
$dompdf->stream($filename.".pdf");
} else {
return $dompdf->output();
}
}
//查看文件代码
......
......
<tr>
<td>
<table width="100%" border="0" style="border:solid 1px #BFBFBF; page-break-inside: auto;" cellspacing="0" cellpadding="10">
<tr bgcolor="#BFBFBF">
<td><p style="font-size:14px; margin:0px;">Product Name</p></td>
<td><p style="font-size:14px; margin:0px;">Product Quantity</p></td>
<td><p style="font-size:14px; margin:0px;">Product Price</p></td>
<td><p style="font-size:14px; margin:0px;">Total Price</p></td>
</tr>
<?php
$product_title = $product_details['product_titles'];
$prod_quantity = $product_details['product_qty'];
$price = $product_details['product_price'];
$total_price = $product_details['product_cal_price'];
$i = 1;
$j = 0;
$productwisetotal = 0;
foreach ($product_title as $value) { $productwisetotal += $value; ?>
<tr style="font-size:12px;" valign="top">
<td style="border-right:solid 1px #BFBFBF"><?php echo $i.'. '.$value; ?></td>
<td style="border-right:solid 1px #BFBFBF"><?php echo $prod_quantity[$j]; ?></td>
<td style="border-right:solid 1px #BFBFBF"></td>
<td style="border-right:solid 1px #BFBFBF"></td>
</tr>
<?php $i++;
$j++;
} ?>
</table>
</td>
</tr>
.....
.....
请告诉我,当表格包含最大记录时,如何在 pdf 中添加分页符??
【问题讨论】:
标签: php codeigniter pdf codeigniter-2 dompdf