Issue when generating fillable PDF in Laravel

396 Views Asked by At

I want generate a pdf file to the customer that can edit it and then download it,
I use Laravel 8, mpdf 0.8.15, niklasravnsborg/laravel-pdf 4.1 and php 7.4
I tried this code with mpdf package in controller :

    $html = file_get_contents(resource_path('views/app/pdf/inventory/inventory2.blade.php'));
     $pdf = new \Mpdf\Mpdf();

        $pdf = Mpdf::loadView('app.pdf.inventory.inventory2');
        $pdf->useActiveForms = true;

        $pdf->WriteHTML($html);
       return $pdf->Output(); 
      // return $pdf->stream('document.pdf');

The view was rendred with blade syntax {{ }} @if... , so it's not useful
also I tried niklasravnsborg/laravel-pdf that can load view not write html content, but the pdf generated was not fillable, It create the form staticly (input, buttons ...) not editale
have you an idea to get a fillable pdf ?

0

There are 0 best solutions below