wkhtmltopdf - QXcbConnection: Could not connect to display

There is a more easy way to make John WH Smith solution.

Just install xvfb from apt and then, you can run:

xvfb-run wkhtmltopdf

(just put xvfb-run before any wkhtmltopdf command.)


This is a bug, and the fix hasn't been brought to the Debian repositories. Quoting ashkulz (who closed the bug report) :

You're using the version of wkhtmltopdf in the debian repositories, which does not support running headless.

So you can either...

  • Download wkhtmltopdf from source and compile it (see the instructions in the INSTALL.md file ; you may remove the --recursive option from their git clone line, if you already have Qt 4.8 installed).
  • Run it inside xvfb, as suggested by masterkorp in the bug report.

on your command line type like this

export DISPLAY=:0 

then run your qt applications

Tags:

Linux

Debian