wkhtmltopdf: cannot connect to X server

wkhtmltopdf is a useful tool for converting HTML document into PDF.  I run it via a cronjob to periodically converting some system reports from HTML format (created by some applications) into PDF.  I’m using a Debian (squeeze) version which requires a X11 server, thus the conversion failed (running it from a cronjob does not have access to a X server).  Luckily there is a workaround: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580226  All I need is a virtual X server (vxfb xvfb) which is available in Debian.  Just run it like the following:

$ vxfb-run xvfb-run wkhtmltopdf ...

3 responses to “wkhtmltopdf: cannot connect to X server

  1. Luis Roman October 31, 2011 at 4:50 pm


    It’s xvfb-run instead of vxfb-run.



  2. Pingback: wkhtmltopdfをUbuntuで使うためのメモ « Network Project 5

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: