'LogicException: You must define a binary prior to conversion
snappy.php get this code
'pdf' => [
'enabled' => true,
'binary' => env('"C:\Program Files\wkhtmltox\bin\wkhtmltopdf-amd64.exe"'),
'timeout' => false,
'options' => [],
'env' => [],
],
and when i try this code for test html to pdf in web.php
Route::get('/', function () {
$snappy = App::make('snappy.pdf');
$snappy->generateFromHtml('<h1>hello</h1>','exemple.pdf');
return view('welcome');
});
Solution 1:[1]
The problem is the executable path.
If Snappy don't find the executable, he get this message.
Please mark the file as executable (chmod +x on linux)
You can see this documentation
Solution 2:[2]
The problem is your binary path, if you are using Windows you must use the path like this:
'binary' => '"C:\Program Files\wkhtmltox\bin\wkhtmltopdf-amd64.exe"'
And make sure the path to the .exe is correct.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Cadot.eu |
Solution 2 | juanma_ |