Aaron Van Bokhoven / aaronvb

I am a Software Developer and a Portrait Film Photographer.
  • I love coding with Ruby and Ruby on Rails, and I love shooting with film.
  • I currently live in Honolulu, Hawaii, but frequent Chicago and California.
  • I believe that programming is a form of art, like painting and photography, where you can express your ideas and logic and see it transform into something real.
Aaron Van Bokhoven
photo: kipkeston
Email me at bokhoven@gmail.com. View my Photography Portfolio. Follow me on Twitter and on Tumblr.

Jul 15, 2010
You're viewing an article, go back to the home page to see more.

If your PDFKit and wkhtmltopdf is working on your development server, probably in OSX, but not working on your production server, which is probably running linux, it's because you're missing X Server.

There are a few ways around this, some emulate X Server, but that seems hacky. I read through the wkhtmltopdf docs and read that a patched qt framework will allow you to use wkhtmltopdf without using X Server.

Here's what I did on my Ubuntu Box to get this to work (note: the compile time for qt was almost 2 hours, and you'll also need to have git installed):


sudo apt-get build-dep libqt4-gui libqt4-network libqt4-webkit
sudo apt-get install openssl build-essential xorg git-core git-doc libssl-dev

mkdir ~/sources
cd ~/sources
git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git wkhtmltopdf-qt
cd wkhtmltopdf-qt
./configure -nomake tools,examples,demos,docs,translations -opensource -prefix ../wkqt
make -j3
make install
cd ..

Next install wkhtmltopdf:


git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf
cd wkhtmltopdf
../wkqt/bin/qmake
make -j3
make install

Run 'wkhtmltopdf' in shell and you should see it load correctly instead of seeing the x server error. Running 'wkhtmltopdf-proxy' should do the same, which is what PDFKit uses.



© Aaron Van Bokhoven