【问题标题】:How to display pdf file from storage in view如何在视图中显示存储中的pdf文件
【发布时间】:2019-06-26 20:57:30
【问题描述】:

我研究了如何在刀片中显示 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)?

【问题讨论】:

标签: php laravel


【解决方案1】:
<iframe src="path_of_pdf_file" width ="100%" height="600px"></iframe>

【讨论】:

  • 请在您的代码中添加一些解释,尤其是关于path_of_pdf_file
  • "path_of_pdf_file" 表示存储 pdf 的本地路径。您需要在 src 属性中提供 pdf 文件路径。
猜你喜欢
  • 2012-07-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-15
  • 2017-09-13
  • 1970-01-01
相关资源
最近更新 更多