【问题标题】:how to open pdf in iframe when click on a tag点击标签时如何在iframe中打开pdf
【发布时间】:2019-09-06 05:29:58
【问题描述】:

单击表格下方同一页面上的打开 PDF 时,我试图在 iframe 中加载 pdf。 当我使用 target=blank 但未在 iframe 中打开时,此 pdf 在新选项卡上打开。

<c:forEach items="${files}" var="file">
<tr>
<td>${file.name}</td>
<td>${file.createdOn}</td>
<td><a href="http://localhost:8080/dms/getFile?filePath=${file.realPath}" target="search_iframe">Open PDF</a></td>
</tr>

</c:forEach>
</table>
<iframe src="" width="100%" height="100%" name="search_iframe"></iframe>
</body>

【问题讨论】:

标签: html spring-boot jstl


【解决方案1】:

我正在使用 bootstrap 4 作为我的主题之一,并在单击按钮时打开模态,在该模态中我放置 iframe 以打开我的 PFD。你也可以试试这个。如果您不使用引导程序,您可以创建自己的自定义模式。

<a href="javascript:void(0);" data-toggle="modal" data-target="#staffInformationForCBSE">

<div class="modal fade" id="staffInformationForCBSE">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title text_orange">Staff Information for CBSE</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
            <div class="modal-body">
                <iframe class="pdf_documents" src="documents/StaffInfoForCBSE.pdf"></iframe>
            </div>
        </div>
    </div>
</div>

【讨论】:

    猜你喜欢
    • 2018-11-04
    • 1970-01-01
    • 1970-01-01
    • 2016-12-23
    • 1970-01-01
    • 1970-01-01
    • 2015-03-15
    • 1970-01-01
    • 2012-10-10
    相关资源
    最近更新 更多