首页 > 解决方案 > 如何在视图中显示存储中的pdf文件

问题描述

我对如何在刀片中显示 pdf 文件进行了研究。我找到了这个答案。但是我应该在刀片中做什么来显示文件?

  $filename = 'test.pdf';
  $path = storage_path($filename); 

  return Response::make(file_get_contents($path), 200, [
      'Content-Type'
  => 'application/pdf',


  'Content-Disposition' => 'inline; filename="'.$filename.'"'

我如何在刀片中显示结果(pdf)?

标签: phplaravel

解决方案


<iframe src="path_of_pdf_file" width ="100%" height="600px"></iframe>

推荐阅读