Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

display pdf file in laravel

Route::get('/pdf/{file}', function ($file) {
      // file path
     $path = public_path('storage/file' . '/' . $file);
      // header
     $header = [
       'Content-Type' => 'application/pdf',
       'Content-Disposition' => 'inline; filename="' . $file . '"'
     ];
    return response()->file($path, $header);
})->name('pdf');
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #display #pdf #file #laravel
ADD COMMENT
Topic
Name
2+3 =