Odoo on Raspbian: Solving Wkhtmltopdf Error Code -6

Odoo is an open source ERP application for business, formerly known as OpenERP. Its core is Python and using PostgreSQL for the database. It’s a web-based app, so that you can install it on a server capable machine. In this case, I talk about Raspberry Pi 2, installed Raspbian Jessie.

By following a brief tutorial from here, I was successfully getting Odoo running on Raspberry Pi 2. But it still had a little glitch: when I want to create PDF report, it threw error:

 Wkhtmltopdf failed (error code: -6). Message: The switch –header-spacing, is not support using unpatched qt and will be ignored.The switch –header-html, is not support using unpatched qt, and will be ignored.The switch –footer-html, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display.

It was due to incompatible version of wkhtmltopdf in Raspbian package repository. And Odoo needs a wkhtmltopdf build with “patched qt”. For this, there has been a troubleshooting, i.e build wkhtmltopdf along with Qt by yourself. Read it here

But, as I read the comments of the post, it would need a lot of time to compile. So, I found again another approach that likely more affordable. Then I finally came to a discussion on wkhtmltopdf’s Github repository and found out a person shared his compiled wkhtmltopdf with unpatched Qt.

So, I downloaded it and replace the original binary of wkhtmltopdf provided by Raspbian with it. Of course I have installed it with sudo apt-get install wkhtmltopdf. Actually, I didn’t delete the original binary, but I just renamed it to /usr/bin/wkhtmltopdf2 and then copied the downloaded one to /usr/bin/wkhtmltopdf. And voila… problem solved. But perhaps you need to restart Apache or Nginx with php5-fpm, or even restart Pi.

odoo-invoice

PDF generated by Odoo

Advertisements

2 thoughts on “Odoo on Raspbian: Solving Wkhtmltopdf Error Code -6

    1. thank you very much for your post. It was very useful.
      Nevertheless, the problem continued until I noticed that the new wkhtmltopdf wasn’t marked as executable. I used mc (midnight commander) to change its attributes, and now it works.
      Thankyou very much and continue posting solutions.

Share your idea here (markdown enabled)

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s