【问题标题】:Dompdf is not working with more than 2 pages dataDompdf 不能处理超过 2 页的数据
【发布时间】:2019-08-27 08:32:27
【问题描述】:

当我在表格中有 85 行时,dompdf 工作正常,但是当我在表格中获得超过 85 行时,第三页中的行没有显示,而不是第二页中的行重叠。

我正在使用带有 codeigniter 的 dompdf。我试图删除我的代码中的所有样式。尝试使用 page-break-before: always;page-break-before: Avoid;page-break-before: auto;

我的 dompdf 代码是 -

public function load_view_download($html,$fileName)
{
$dompdf = new Dompdf();        
$dompdf->loadHtml($html);       
$dompdf->setPaper('A4', 'potrait');       
$dompdf->render();        
$time = time();        
$dompdf->stream($fileName.'_'.$time);

}

html 代码是 -

<!DOCTYPE html>
<html lang="en">
<head> 
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body class="invoice_main_wrapper" >
<div class="invoice" >
<table >
<tbody>
<tr>
<td>
<table >
<thead >
<tr>
<td >#</td>
<td >item</td>
<td>code</td>
<td >tag</td>
<td >MRP</td>
<td >Qty</td>
<td >Price</td>                                                
<td >AMOUNT</td>
</tr>
</thead>
<tbody class="invoice_bd" > 
<?php for($i=1;$i<=100;$i++){?>
<tr class="bb_td">
<td ><?=$i?></td>
<td >gafd</td>
<td >adfa</td>
<td >adfdas</td>
<td >1000</td>
<td >10</td>
<td >100</td>
<td >100</td> 
</tr>
<?php }?>
<!-- for total -->
<tr class="bb_td">
<td ></td>
<td ></td>
<td ></td>
<td ></td>
<td >Total</td>
<td >121</td>
<td >100</td>
<td >1000</td>   
</tr>           
</tbody>
</table>
</td>
</tr>
<tr>
<td >
<table class="subtotal_invoice" style="border-spacing: 0px; float:right;">
<tr>
<td >Total In Words:</td>
<td >Five hundred</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<div class="note" style="font-weight: 600; width:100%;marign-top: 100px;" >
<h5 style="font-size: 14px;font-weight: 400;">
 Hello
</h5>
<div style="border-bottom: 1px solid #AFAFAF;">
<h5 style="margin:0;font-size: 14px;font-weight: 400;line-height: 0;"></h5>                    
</div>
</div>
<!-- footer --> 
</div>

控制器代码是 -

$this->content['data']['title'] = 'pdf'
$html = $this->load->view('testpdf', $this->content, true);    

$this->pdf->load_view_download($html,'testpdf');

超过 85 行我遇到了这个问题。请检查图片 https://ibb.co/gD0x7Js

如果行数少于或等于 85,则可以正常工作。请检查图像 https://ibb.co/qkX0pBg

【问题讨论】:

    标签: html codeigniter dompdf


    【解决方案1】:

    对于多个文件,最好使用 Mpdf。 Mpdf 轻松将 HTML 转换为 PDF

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-28
      • 2019-09-02
      • 1970-01-01
      • 2016-12-19
      • 1970-01-01
      • 1970-01-01
      • 2019-06-08
      • 2012-02-02
      相关资源
      最近更新 更多