laravellaravel-5wkhtmltopdfvpscentos6.5

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


Solution

  • 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"

    :)