Wkhtmltopdf Errno::EPIPE (Broken pipe)

internal error

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 http://wkhtmltopdf.org/downloads.html

1/ sudo apt-get install xvfb
2/ wget https://bitbucket.org/wkhtmltopdf/wkhtmltopdf/downloads/wkhtmltox-0.13.0-alpha-7b36694_linux-jessie-amd64.deb
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

Try Easy Redmine in 30 days free trial

Full features, SSL protected, daily backups, in your geolocation