Html 在 DIV 或面板中显示 PDF 的最佳方式是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29941646/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:55:29 来源:igfitidea点击:
what is the best way to display PDF in DIV or panel
提问by dhaval soni
What is the best way to show PDF file in DIV.
在 DIV 中显示 PDF 文件的最佳方式是什么。
I need to show generated PDF into one of the tab of jquery Accordian tab.
我需要将生成的 PDF 显示到 jquery Accordian 选项卡的选项卡之一中。
Can any one guide what is the best way to move.
任何人都可以指导什么是最好的移动方式。
回答by dhaval soni
I used below option to embed:
我使用以下选项嵌入:
<embed src="pdfFiles/interfaces.pdf" width="600" height="500" alt="pdf" pluginspage="http://www.adobe.com/products/acrobat/readstep2.html">
回答by stanze
Try using this
尝试使用这个
<div class="PDF">
<object data="your.pdf" type="application/pdf" width="750" height="600">
alt : <a href="your.pdf">your.pdf</a>
</object>
</div>
回答by Alireza Balvardi
$obj = $('<object>');
$obj.attr("data","http://infolab.stanford.edu/pub/papers/google.pdf");
$obj.attr("type","application/pdf");
$obj.addClass("w100");
$("#pdfdiv_content").append($obj);
#pdfdiv_content{
width:100%;
height:250px;
border:1px solid #0000FF;
position:relative;
height:800px;
}
.w100{
width:100%;
position:absolute;
height:100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<div id="pdfdiv_content"></div>