0

My app uses the library https://github.com/wkhtmltopdf/wkhtmltopdf which requires X server. Here's a workaround:

echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/wkhtmltopdf.sh
chmod a+x /usr/bin/wkhtmltopdf.sh
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf
wkhtmltopdf http://www.google.com output.pdf

I've installed xvfb via pacman and followed the steps in the link. However, nothing has changed: it still returns an error

  wkhtmltopdf http://www.google.com output.pdf

===>

 "qt.qpa.screen: QXcbConnection: Could not connect to display :0.0"

And

$ which wkhtmltopdf
/usr/local/bin/wkhtmltopdf
jerry
  • 131

1 Answers1

0

You should try to run wkhtmltopdf.sh instead of just wkhtmltopdf. Seems like you are calling the original binary instead of the xvfb wrapper you created.

To make sure which one you are running try to run "which wkhtmltopdf".

Evengard
  • 234