从 S3 存储桶获取 pdf 并以引导模式显示



如何获取和显示从 S3 存储桶获取 pdf 并在引导模式中显示,

我已经尝试过如下

//href to open modal
<a href="#" data-toggle="modal" data-target="#InvoiceModal">Filename</a>

//bootstrap modal
<div id="InvoiceModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Invoice</h4>
</div>
<div class="modal-body">
//here i am trying to fecth pdf file
<embed src="<?php echo base_url('https://s3-us-west-2.amazonaws.com/j2wmsp/production/invoice_reports/2018-10-05%2011:58:38-Invoice6(%20Venkata%20Sameer%20Kota-Sep%202018).pdf'); ?>"
frameborder="0" width="100%" height="400px">
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

上面的代码显示空模态,如何显示PDF文件,

谢谢。

问题不在于引导模型。问题出在亚马逊3存储桶中。 您需要更改内容类型和内容处置。

Content-Type: application/pdf;
Content-Disposition: inline;

使用AWS S3 控制台找到该文件,然后使用上下文菜单(右键单击(选择属性,然后它位于元数据下。

最新更新