[英]how to generate many pdf pages with mpdf1?
im usign mpdf1,我需要打印一个包含4000行的表格的pdf。
我如何使用mpdf1做到这一点?
有办法避免等待几分钟吗?
现在mpdf 6.0可用了,并且很稳定。 我已经下载了mpdf 6.0并解压缩到mpdf60文件夹中。 以下代码示例显示了如何使用html表生成PDF。
<?php
include_once ('mpdf60/mpdf.php');
$mpdf = new mPDF();
$mpdf->SetAuthor('StackOverflow');
$html = getLargeTableHtml();
$mpdf->WriteHTML($html);
$mpdf->Output('filename.pdf');
function getLargeTableHtml()
{
$html = '<table border="1">';
for($cou = 1; $cou <= 4000; $cou++) {
$html .= '<tr><td>row - ' . $cou . '</td><td>' . md5(rand()) .'</td></tr>';
}
$html .= '</table>';
return $html;
}
如果要以无阻碍的方式发送pdf响应,则模式很少。
1.)如果大表没有随时间更改内容(静态数据)
2.)如果大表的动态内容随时间变化
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.