wkhtmltopdf - laravel-snappy pdf generation fails with no error -


i have installed laravel-snappy following instructions on https://github.com/barryvdh/laravel-snappy

following installation tested wkhtmltopdf , works:

vagrant@homestead:/usr/local/bin$ /usr/local/bin/wkhtmltopdf google.com /tmp/google.pdf loading pages (1/6) counting pages (2/6) resolving links (4/6) loading headers , footers (5/6) printing pages (6/6) done 

i can confirm pdf exists:

vagrant@homestead:/tmp$ ls google.pdf 

this contents of snappy.php file:

return array(       'pdf' => array(         'enabled' => true,         'binary'  => '/usr/local/bin/wkhtmltopdf',         'timeout' => false,         'options' => array(),         'env'     => array(),     ),     'image' => array(         'enabled' => true,         'binary'  => '/usr/local/bin/wkhtmltoimage',         'timeout' => false,         'options' => array(),         'env'     => array(),     ),   ); 

however when run in controller, nothing happens. no error message , no file generated:

function pdfreport($id)  {     $html = '<h1>hi</h1>';      $pdf = pdf::loadhtml($html)->setpaper('a4')->setorientation('portrait');      return $pdf->download('test.pdf');  } 

i expecting pdf start downloading. issue?

i have made work installing snappy without laravel wrapper. doing this:

use knp\snappy\pdf;  $snappy = new pdf('/usr/local/bin/wkhtmltopdf'); header('content-type: application/pdf'); header('content-disposition: attachment; filename="file.pdf"'); echo $snappy->getoutput('http://www.github.com'); 

perhaps there issue laravel wrapper.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -