使用下面的代码创建的pdf还没有完成呈现javascript,因此在一半的表上执行了javascript(比如说有100个表然后有50个表完成,其他时间52,54等).
我正在使用该标志--javascript-delay 40000试图延迟页面的检索,但结果是相同的.它仍在快速拉动扳机.我知道这是问题,因为当我使用浏览器时,一切正常.
如何正确设置延迟?也许shell_exec这里有错?
$command = shell_exec("xvfb-run -a -s '-screen 0 640x480x16' wkhtmltopdf-i386 --dpi 300 --javascript-delay 40000 --page
Run Code Online (Sandbox Code Playgroud)
编辑:
使用版本:
wkhtmltopdf-0.11.0_rc1
Run Code Online (Sandbox Code Playgroud)
Tom*_*Tom 16
搜索几小时后发现问题.wkhtmltopdf停止慢脚本:
Loading pages (1/6)
Warning: A slow script was stopped
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Run Code Online (Sandbox Code Playgroud)
所以我需要使用标志--no-stop-slow-scripts:
$command = shell_exec("xvfb-run -a -s '-screen 0 640x480x16' wkhtmltopdf-i386 --no-stop-slow-scripts --dpi 300 --page-size A4 $page /tmp
Run Code Online (Sandbox Code Playgroud)