4

This doesn't work

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

But this works:

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

Please notice how the files are being created above

Files Attached (Google Drive Links):

I am on Ubuntu 14.04 (64Bit)

No errors in both commands, files are generated properly with file size:

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

On windows, it is working as expected.

There are minor changes in Raw Data, which I am not able to understand.

Has anyone faced similar issue ? Can anyone point me to link to the solution, i couldn't find here on SO or the net.

Jigar
  • 3,256
  • 1
  • 30
  • 51

1 Answers1

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

executing wkhtmltopdf in quiet mode (-q) fixed the issue. As even the following was prepended in the pdf file:

Loading page (1/2)
Printing pages (2/2)
Done
Jigar
  • 3,256
  • 1
  • 30
  • 51
  • FYI: Seems this was fixed in newer versions https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1915 https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1980 – antak Feb 10 '17 at 12:53