qxcbconnection: could not connect to display : Do you have Face an issue with wkhtmltopdf install in ubuntu linux then We will some help you how to fix that error. if you have error such as a qxcbconnection: could not connect to display wkhtmltopdf ubuntu.
Table of Contents
Solved – QXcbConnection could not connect to display wkhtmltopdf ubuntu
“forge@billowing-star:~$ wkhtmltopdf http://www.google.com google.pdf
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.”
Step 1 : Install wkhtmltopdf
sudo apt-get update sudo apt-get install wkhtmltopdf
Step 2 : Generate PDF File using wkhtmltopdf
wkhtmltopdf https://google.com google.pdf
Get Error Like bellow:
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.
step 3: Install xvfb:
sudo apt-get update sudo apt-get install xvfb
Generate PDF File using xvfb wkhtmltopdf:
xvfb-run wkhtmltopdf https://google.com google.pdf
Step 4: Create Alias:
alias wkhtmltopdf='xvfb-run wkhtmltopdf'
step 5: Use Alias:
wkhtmltopdf https://google.com google.pdf
Also Read : qxcbconnection: could not connect to display