mardi 19 novembre 2019

Laravel Snappy PDF don't find the file path

On my PC laravel snappy pdf works perfectly, but when I send the files to the server it gives error when generating PDF. This is the error:
enter image description here

This is my config/snappy.php

    'pdf' => [
    'enabled' => true,
    'binary' => base_path('vendor\wemersonjanuario\wkhtmltopdf-windows\bin\64bit\wkhtmltopdf'),
    'timeout' => false,
    'options' => array(),
    'env'     => array(),
],

'image' => [
    'enabled' => true,
    'binary' => base_path('vendor\wemersonjanuario\wkhtmltopdf-windows\bin\64bit\wkhtmltoimage'),
    'timeout' => false,
    'options' => array(),
    'env'     => array(),
],

This is how I generate the PDF:

$filename = strtolower(str_replace(" ", "-", $user->id .'-'. $product->name)) . '-' . date('dmY') . '-' . date('Hisu') . '.pdf';
    $pdf = PDF::loadView('admin-customer.tag.pdf-view', $product)
                ->setOption('page-width', '100')
                ->setOption('page-height', '70.5')
                ->setOption('margin-top', 2)
                ->setOption('margin-bottom', 2)
                ->setOption('margin-left', 2)
                ->setOption('margin-right', 2)
                ->setOption('images', true)
                ->output();
    $disk = Storage::disk('pdf');
    if ($disk->put($filename, $pdf)) {
        return redirect('/cliente/etiquetas');
    }

This is my vendor folder:
enter image description here

I've searched several forums and still can't solve it. Can anyone help me?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire