我使用WKHTMLTOPDF将html页面转换为pdf。我写了下面的代码。
system("wkhtmltopdf http://localhost/advisory_system/frontend/index.php/Analysis/fpdf /opt/lampp/htdocs/pdf_testo/test1/pdf_final_testA_$i.pdf 2>&1");
在我的PHP脚本中使用上述脚本时,它会输出STATUS,如:
加载页面(1/6)[> ] 0%[======> ] 10%[=========> ] 15% [==========> ] 18%[============> ] 21%[=================> ] 29% [========================> ] 41%[==========================> ] 44% [==============================> ] 50% [================================================= ===========] 100% 计数页数(2/6) [================================================= ===========]对象 1 of 1解决链接(4/6) [================================================= ===========]对象 1 of 1加载页眉和页脚(5/6)打印页面(6/6)[> ] 准备[=====> ]第1页,共11页[==========> ]第2页,共11页 [================> ]第3页,共11页[=====================> ]第4页 11 [===========================> ]第5页,共11页 [================================> ]第6页,共11页 [=====================================> ]第7页,共11页 [===========================================> ]第8页,共11页 [================================================&GT ; ]第9页,共11页 [================================================= =====> ]第10页 11 [================================================ ============] 11 of 11完成
如何通过wkhtmltopdf阻止输出此类状态?
版本为:0.12.1(已修补qt)
答案 0 :(得分:1)
最后我通过使用PHP的exec函数得到了解决方案。它只是执行命令并且在system函数输出执行输出时不发送输出。 所以我的脚本现在看起来像:
exec("wkhtmltopdf http://localhost/advisory_system/frontend/index.php/Analysis/fpdf /opt/lampp/htdocs/pdf_testo/test1/pdf_final_testA_$i.pdf 2>&1");
答案 1 :(得分:0)
您可以通过如下设置默认配置和详细配置来阻止wkhtmltopdf输出状态:
config.default_options = {
:quiet => true,
:debug_javascript => false
}
config.verbose = false