On Mon, 12 Dec 2016 15:06:08 +0100 Manolo =?UTF-8?B?RMOtYXo=?= 
<diaz.man...@gmail.com <mailto:diaz.man...@gmail.com>> wrote:
> Package: wkhtmltopdf
> Version: 0.12.3.2-3
> Severity: important
> 
> Dear Maintainer,
> 
> Otherwise it fails with
> 
>       QXcbConnection: Could not connect to display
> 
> That makes this application unsuitable for unattended tasks, such a cron
> task, and prevents its use from the console.
> 
> Best Regards,
> -- 
> Manolo Díaz
> 
> 


Please consult 
https://sources.debian.net/src/wkhtmltopdf/0.12.3.2-3/debian/README.Debian/ 
<https://sources.debian.net/src/wkhtmltopdf/0.12.3.2-3/debian/README.Debian/> 
which I’m quoting below:
Due to its dependency on Qt-WebKit, wkhtmltopdf requires an X11 server to
run. If you want to provide an automated service or use wkhtmltopdf from a
webserver, it could be convenient to use a virtual X11 server (like Xvfb).
The xvfb Debian package contains a wrapper which makes it trivial:

    xvfb-run -- wkhtmltopdf [options]

 -- Cyril Brulebois <k...@debian.org <mailto:k...@debian.org>>, Mon,  7 Feb 
2011 01:11:31 +0100

Another way I found to overcome the display connection error and make it work 
without an X server is:
QT_QPA_FONTDIR=/usr/share/fonts/truetype/dejavu/ QT_QPA_PLATFORM=offscreen 
wkhtmltopdf page.html index.pdf
Unfortunately I could not find much documentation about the offscreen platform 
of Qt.

Regards,
Dimitris Zorbas

Reply via email to