环境ubuntu 16.04
-
apt-get install wkhtmltopdf
- apt-get install xvfb
- echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh
- chmod a+x /usr/bin/wkhtmltopdf.sh
- ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf
结果验证
wkhtmltopdf http://www.baidu.com test.pdf