将pdf上传到s3存储桶中,并使用其链接,我想显示它。它们是用firefox和chrome下载的。怎么办?
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Document</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<object data="[PDF link]">
<iframe src="[PDF link]&embedded=true"></iframe>
</object>
</div>
<div class="modal-footer">
<button type="button" class="btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
$(function () {
var fileName = "Youpdfwithextension";//or path of pdf with extenstion
$("#btnShow").click(function () {
$("#dialog").dialog({
modal: true,
title: fileName,
width: 540,
height: 450,
buttons: {
Close: function () {
$(this).dialog('close');
}
},
open: function () {
var object = "<object data=\"{FileName}\" type=\"application/pdf\" width=\"500px\" height=\"300px\">";
object += "If you are unable to view file, you can download from <a href = \"{FileName}\">here</a>";
object += " or download <a target = \"_blank\" href = \"http://get.adobe.com/reader/\">Adobe PDF Reader</a> to view the file.";
object += "</object>";
object = object.replace(/{FileName}/g, "Files/" + fileName);
$("#dialog").html(object);
}
});
});
});
<input id="btnShow" type="button" value="Show PDF" />
<div id="dialog" style="display: none">
</div>