Anchor href Routing not working for Downloading a View into pdf

485 views Asked by At

I am using laravel-snappy when i route to the controller for the download using the anchor tag href.

" <a href="{{ route('generate-pdf',['download'=>'pdf']) }}">Download PDF </a>"

It goes to

http://localhost:8000/%7B%7B%20route('generate-pdf',['download'=%3E'pdf'])%20%7D%7D

Router:

Route::get('generate-pdf', 'PdfGenerateController@pdfview')->name('generate-pdf');

Controller:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use PDF;
class provider extends Controller
{
    public function generate_pdf() {

    $pdf = PDF::loadView('welcome.blade', $data);
return $pdf->download('invoice.pdf');
}"

Is this the right way to use the laravel-snappy? to download a view?

0

There are 0 answers