-1

I want to display a pdf from my public/files/filename in a blade file without downloading it. Visitors can see the pdf. I am using laravel 8 for this project.

This is the code but it is downloading the file without viewing it

 <embed src="{{ asset('files/hiring-process.pdf')  }}" type="application/pdf" width="100%" height="500px" />

1 Answers1

0

You can use the DomPDF package of Laravel to preview pdf file to use instead of downloading it

$pdf = PDF::loadView('pdf', ['data_for_pdf' => $data])->setPaper('a4', 'portrait');

return $pdf->download('Report.pdf');

be awar of: the user's browser settings could also affect this behavior

MANSOOR KOCHY
  • 370
  • 2
  • 9