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
[php]
sudo apt-get update
sudo apt-get install wkhtmltopdf
[/php]
Step 2 : Generate PDF File using wkhtmltopdf
[php]
wkhtmltopdf https://google.com google.pdf
[/php]
Get Error Like bellow:
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.
step 3: Install xvfb:
[php]
sudo apt-get update
sudo apt-get install xvfb
[/php]
Generate PDF File using xvfb wkhtmltopdf:
[php]
xvfb-run wkhtmltopdf https://google.com google.pdf
[/php]
Step 4: Create Alias:
[php]
alias wkhtmltopdf=’xvfb-run wkhtmltopdf’
[/php]
step 5: Use Alias:
[php]
wkhtmltopdf https://google.com google.pdf
[/php]
Also Read : qxcbconnection: could not connect to display