Error When Printing Odoo Report Wkhtmltopdf Failed (Error Code -6)
This kind of error happens when user are trying to print certain document like Delivery Order, Sales Order, or any kind of report file. This happens because there's a problem with report generator that odoo use, which is wkhtmltopdf. The error message appears like below:
Wkhtmltopdf failed (error code: -6). Message: b'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 \n'
The solution is quite simple, we need to reinstall wkhtmltopdf by following this commands. If you really confused, try to execute line by line.
Now, try to restart odoo service or the server and print the report. It should be able to download and view.
apt remove wkhtmltopdf
tar xvf wkhtmltox*.tar.xz
sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin
sudo apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
|wkhtmltopdf, HTML converter to PDF. Source : wkhtmltopdf.org