当前位置: 首页 > 工具软件 > Tox > 使用案例 >

wkhtmltopdf: cannot connect to X server

尉迟宣
2023-12-01

wkhtmltopdf needs a X server. If you're running your application on a VPS, you probably don't have one installed. The solution is install a "virtual" X server.

using wkhtmltopdf without X server



To install wkhtmltopdf in a Debian/Ubuntu server, follow this steps(as root):


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.google.com output.pdf

 类似资料:

相关阅读

相关文章

相关问答