Manager ManagerWkhtmltopdf Errno::EPIPE (Broken pipe)

Author: Manager Manager Displayed: 7636
Created: 01/09/2016 Updated: 01/09/2016
Version: 1

User can't use pdf exports via pdfkit (invoicing, cost estimation (calculation), exporting templates)

Errno::EPIPE (Broken pipe) or wkhtmltopdf: cannot connect to X server


The problem is that the standard installation of wkhtmltopdf via apt-get, doesn't work on a headless server (0.9.9).

Get needed version of wkhtmltopdf from

1/ sudo apt-get install xvfb
2/ wget
3/ sudo dpkg -i wkhtmltox-0.13.0-alpha-7b36694_linux-jessie-amd64.deb
4/ sudo apt-get -f install
5/ sudo mv /usr/local/bin/wkhtmltopdf /usr/local/bin/xwkhtmltopdf
6/ echo 'exec xvfb-run -a -s "-screen 0 640x480x16" xwkhtmltopdf "$@"' | sudo tee /usr/local/bin/wkhtmltopdf >/dev/null
7/ sudo chmod a+x /usr/local/bin/wkhtmltopdf

Add picture from clipboard