wkhtmltopdf "file output vs stdout" on ubuntu with x server (xvfb-运行)

wkhtmltopdf "file output vs stdout" on ubuntu with x server (xvfb-run)

这行不通

echo '<p>Hello</p>' | /usr/bin/xvfb-run -a /usr/bin/wkhtmltopdf - - > ~/notworking.pdf

但这行得通:

echo '<p>Hello</p>' | /usr/bin/xvfb-run -a /usr/bin/wkhtmltopdf - ~/working.pdf

请注意上面的文件是如何创建的

附加文件(Google 驱动器链接):

我在 Ubuntu 14.04(64 位)

两个命令都没有错误,文件大小正确生成:

ubuntu@ip-*-*-*-*:~$ du -s -B1 ~/working.pdf
8192    /home/ubuntu/working.pdf
ubuntu@ip-*-*-*-*:~$ du -s -B1 ~/notworking.pdf
8192    /home/ubuntu/notworking.pdf

在 windows 上,它按预期工作。

原始数据有细微变化,我无法理解。

有没有人遇到过类似的问题?谁能指出 link 解决方案,我在 SO 或网上找不到。

echo '<p>Hello</p>' | /usr/bin/xvfb-run -a /usr/bin/wkhtmltopdf -q - - > ~/notworking.pdf

在安静模式下执行 wkhtmltopdf (-q) 解决了这个问题。因为在 pdf 文件中甚至添加了以下内容:

Loading page (1/2)
Printing pages (2/2)
Done