【发布时间】:2016-10-10 16:03:03
【问题描述】:
如何获取 dompdf 的进度。我有很多正在使用 dompdf 转换为 pdf 的 html。因为 HTML 很多,所以需要一段时间,所以我想知道是否可以获取进度并将其显示给用户。
编辑:
根据建议,我决定使用微调器。但我需要知道用户何时收到文件。 我正在使用此代码生成从 here 复制的 pdf:
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream();
当用户点击执行此代码的链接时会生成 pdf。 pdf 下载并显示在下载部分。
编辑 2:现在我正在尝试使用 ajax 处理下载。我正在接收数据,并且在执行 console.log() 时可以看到它,但是如何将文件保存在用户下载中? 谢谢
【问题讨论】: