2017-03-29 71 views
0

我已经通过mpdf库生成pdf,我的pdf需要4-5分钟才能生成pdf。 我想添加百分比进度条来显示生成pdf时的进度。如何为mpdf添加进度条

如何添加JavaScript或PHP代码为百分比进度条显示进度

+0

入住这里https://mpdf.github.io/reference/mpdf-functions/startprogressbaroutput.html – Nawin

+0

感谢您的回复 我已经检查MPDF功能,但我得到了一些错误 – user3811650

+0

你面对的是什么错误? – Nawin

回答

0
define('_MPDF_URI','../');  // must be a relative or absolute URI - not a file system path 

$mpdf = new mPDF(); 

$mpdf->StartProgressBarOutput(2); 

$mpdf->WriteHTML('You will hardly have time to see the progress bars!'); 

$mpdf->Output(); 

从源Link

+0

感谢您的答复。 我检查了你给定的链接,但得到了一些错误 我根据给定的建议进行了修改。 在config.php我做了$ this-> progressBar = 1; 并添加了代码 $ mpdf-> StartProgressBarOutput(); $ mpdf-> Output();出口; 但它在pdf生成时重定向,如 http://localhost/opt/lampp/htdocs/myfoldername/wp-content/plugins/products-pdf/pdf_data/mpdf60/includes/out.php id there ant other方式来生成进度条 – user3811650

+0

你传递了​​你的绝对URL吗? – Nawin

+0

是的,我已经通过包括mpdf文件的绝对路径 require_once PDF_CATALOG__PLUGIN_DIR。 'pdf_data/mpdf60/mpdf.php'; – user3811650

0

尝试使用此方法:

https://mpdf.github.io/reference/mpdf-functions/startprogressbaroutput.html

在页面底部是例子。

+0

感谢您的回复。 我检查了你给定的链接,但得到了一些错误 我根据给定的建议进行了修改。 在config.php我做了$ this-> progressBar = 1; 并添加了代码 $ mpdf-> StartProgressBarOutput(); $ mpdf-> Output();出口; ,但它在pdf生成时重定向像 http://localhost/opt/lampp/htdocs/myfoldername/wp-content/plugins/products-pdf/pdf_data/mpdf60/includes/out.php – user3811650

+0

如何添加JavaScript的进度酒吧为PDF,我无法添加JavaScript代码来显示进度 – user3811650