Issue related to wkhtmltopdf

1,944 views
Skip to first unread message

Rahul Developer

unread,
Jun 5, 2021, 1:40:59 AM6/5/21
to wkhtmltopdf General
Hello 

I am creating pdf with graph in a laravel application by using wkhtmltopdf. Everything is working fine in my local system but I am facing issue on my production server. 
Showing error - QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-www-data' qt.qpa.screen: QXcbConnection: Could not connect to display Could not connect to any X display.

Working environment - Ubuntu 18.04
My code is like -
use mikehaertl\wkhtmlto\Pdf

        $render = view('chart')->render();
        $pdf = new Pdf;
        $pdf->addPage($render);
        $pdf->setOptions(['javascript-delay' => 5000]);
        $pdf->saveAs(public_path('report.pdf'));
        return response()->download(public_path('report.pdf'));

I am unable to find the solution for this issue.
Please help me.

Thanks and regards
Rahul Sharma

Rahul Developer

unread,
Jun 8, 2021, 3:14:01 AM6/8/21
to wkhtmltopdf General
I found the solution

Just install the latest version

sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb

sudo apt install ./wkhtmltox_0.12.6-1.bionic_amd64.deb

It worked for me on Ubuntu 18.04

Reply all
Reply to author
Forward
0 new messages