3 years ago

how to generate PDF from blade laravel 5.1

Posted 3 years ago by dilfdo

i want to generate pdf file when user clicking id of the each row of my index view


 <td style="">{{$user->id}}</td>
      <td><a href="{{url('user') . '/' . $user->id . '/view'}}"><i class="glyphicon glyphicon-th-large"></i></a></td>

and my user view function in controller

public function customerView($id) {
    $user = Festivals::where('id',$id)->first();

return view('user.view',['user'=>$user,'type'=>'Customer - View User Details']);


i want to add generate pdf option when user click on index page id and in specific view page both.

please advice me

i tried using dompdf , but it didnt work

    public function pdf($id)
      $user = Festivals::where('id',$id)->first();
       $pdf = PDF::loadView('user.view', $user);
return $pdf->download('invoice.pdf');

Please sign in or create an account to participate in this conversation.