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