I do not get the pdf in my project laravel 5.5 [closed]

-1

I am trying to generate a pdf and when I run the function the blank screen appears. I'm using domPdf for this

This is the code that I have in my controller:

public function pdf_facturas($id){


        $data = ['esto es una prueba'];

        $pdf = PDF::loadview('facturas.pdf_facturas', $data);
         $pdf->download('pdf_facturas.pdf');

        // view('facturas.pdf_facturas');
    }

On my route I have this:

Route::get('pdf_facturas/{id}', 'FacturaController@pdf_facturas')->name('pdf_facturas');
    
asked by albertolg89 04.04.2018 в 14:17
source

1 answer

1

Your code is missing the return

public function pdf_facturas($id){

    $data = ['esto es una prueba'];

    $pdf = PDF::loadview('facturas.pdf_facturas', $data);

    return $pdf->download('pdf_facturas.pdf'); //<- return agregado
}

Greetings!

    
answered by 04.04.2018 в 18:06