问题
Every time a PDF is created in WKHTMLTOPDF (using php) i am getting the following in the apache error log:
Loading pages (1/6)
[> ] 0%
[======> ] 10%
[==========> ] 17%
[===================> ] 32%
[==============================> ] 50%
[=====================================> ] 63%
[============================================> ] 74%
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[============================================================] Page 1 of 1
Done
However the pdf is created without any errors, is there a way of stopping this as the error logs are getting very large and also masking genuine errors?
Thanks
回答1:
To silence wkhtmltopdf specifically:
Use the
--quiet
flag:exec("wkhtmltoimage -q …");
And redirect stderr per
2>/dev/null
or similar shell features:exec("wkhtmltopdf -q … 2>&1");
The latter works with most command-line tools, btw.
来源:https://stackoverflow.com/questions/31221196/wkhtmltopdf-writes-in-apache-error-log-for-every-pdf-created