【问题标题】:Fetch pdf from S3 bucket and display in bootstrap modal从 S3 存储桶中获取 pdf 并以​​引导模式显示
【发布时间】:2018-10-08 11:33:43
【问题描述】:

如何从 S3 存储桶中获取并显示 Fetch 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文件,

谢谢。

【问题讨论】:

  • 由于您的问题到目前为止还没有得到很多关注,我建议您访问How to Ask,以便更好地了解如何提出一个可靠的问题。此外,需要一些错误和更好的解释才能让其他人为您提供帮助(他们首先需要了解实际问题是什么)。 请相应地编辑您的帖子,这样您就可以获得答案

标签: php html codeigniter pdf amazon-s3


【解决方案1】:

问题不在于引导模型。问题出在 amazons3 存储桶中。 您需要更改 Content-Type 和 Content-Disposition。

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-01
    • 1970-01-01
    • 2022-01-09
    • 2016-06-22
    • 1970-01-01
    • 1970-01-01
    • 2021-05-06
    • 1970-01-01
    相关资源
    最近更新 更多