Yuvraj Singh Shekhawat
Yuvraj Singh Shekhawat

Reputation: 323

Exception in Wkhtml2pdf.php line 887: WKHTMLTOPDF didn't return any data in laravel

My all PDF working properly in previous server when i transfer my website to VPS it is not working.

Exception in Wkhtml2pdf.php line 887: WKHTMLTOPDF didn't return any data

in Wkhtml2pdf.php line 887 at Wkhtml2pdf->_render() in Wkhtml2pdf.php line 1030 at Wkhtml2pdf->output('I', 'Leave-2016-11-19 00:01:06.pdf') in Wkhtml2pdf.php line 242

Upvotes: 1

Views: 3123

Answers (2)

Nedvajz
Nedvajz

Reputation: 1029

Another possible error is QT patch missing for wkhtmltopdf

Explanation here: https://stackoverflow.com/a/64260740/2686510

Solution is to us patched version:

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
mv wkhtmltox/bin/wkhtmlto* /usr/bin/
ln -nfs /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf  

Upvotes: 0

Yuvraj Singh Shekhawat
Yuvraj Singh Shekhawat

Reputation: 323

After a long time, i resolve my problem myself.

For LARAVEL. First open config/Wkhtml2pdf.php file

and

return array(

'debug' => false,
'binpath' => 'lib/',
'binfile' => 'wkhtmltopdf-amd64',
'output_mode' => 'I'

);

to

return array(

'debug' => true,
'binpath' => 'lib/',
'binfile' => 'wkhtmltopdf-amd64',
'output_mode' => 'I'

);

And run again in browser.

you see an array like this :

array:3 [▼ "input" => "/tmp/163448393.html" "command" => "/var/www/html/somsv3/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib/wkhtmltopdf-amd64 --orientation 'Portrait' --page-size 'A4' "/tmp/163448393.html" -" "content" => array:3 [▶] ]

here content is your PDF.

open "content" and fix permission issue of file give it chmod -R 777 "filename"

:)

Upvotes: 2

Related Questions