qxcbconnection: could not connect to display – How To Fix qxcbconnection: could not connect to display?

Solved – (qxcbconnection: could not connect to display) QXcbConnection could not connect to display wkhtmltopdf ubuntu Just install xvfb from apt and then, you can run: xvfb-run wkhtmltopdf

QXcbConnection: Could not connect to display

wkhtmltopdf – QXcbConnection: Could not connect to display – qt.qpa.screen: QXcbConnection: Could not connect to display localhost:0.0 Could not connect to any X display.

Install wkhtmltopdf

sudo apt-get update
sudo apt-get install wkhtmltopdf

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.

Best Solution for : qxcbconnection: could not connect to display

step 1 : Install xvfb:

sudo apt-get update
sudo apt-get install xvfb

step 2 : Generate PDF File using xvfb wkhtmltopdf:

xvfb-run wkhtmltopdf https://google.com google.pdf

After that it should generate pdf file using xvfb wkhtmltopdf:.

you can also make simply step to alias for xvfb-run wkhtmltopdf as like bellow Example:

Don’t Miss : 419 Page Expired

Step 3: Make Alias:

alias wkhtmltopdf='xvfb-run wkhtmltopdf'

Step 4: Use Alias:

wkhtmltopdf https://google.com google.pdf

I hope you get an idea about qxcbconnection: could not connect to display.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment