在HTML中嵌入PDF的推荐方法是什么?
iFrame吗? 对象? 嵌入?
Adobe是怎么说的呢?
在我的例子中,PDF是动态生成的,因此不能在刷新之前将其上传到第三方解决方案。
在HTML中嵌入PDF的推荐方法是什么?
iFrame吗? 对象? 嵌入?
Adobe是怎么说的呢?
在我的例子中,PDF是动态生成的,因此不能在刷新之前将其上传到第三方解决方案。
当前回答
值得注意的PDF是您应该考虑的选项之一 它有一个免费的计划,除非你打算在pdf文件上进行实时在线协作
将以下iframe嵌入到任何html并享受结果:
<iframe width='1000' height='800' src='http://bit.ly/1JxrtjR' frameborder='0' allowfullscreen></iframe>
其他回答
看看这段代码-将PDF嵌入HTML
<!-- Embed PDF File -->
<object src="YourFile.pdf" type="application/pdf" title="SamplePdf" width="500" height="720">
<a href="YourFile.pdf">shree</a>
</object>
这是快速、简单、直截了当的,不需要任何第三方脚本:
<embed src="http://example.com/the.pdf" width="500" height="375"
type="application/pdf">
更新(2/3/2021)
Adobe现在提供了自己的PDF嵌入API。
https://www.adobe.io/apis/documentcloud/dcsdk/pdf-embed.html
更新(1/2018):
Android上的Chrome浏览器不再支持PDF嵌入。你可以通过使用谷歌Drive PDF查看器来解决这个问题
<embed src="https://drive.google.com/viewerng/
viewer?embedded=true&url=http://example.com/the.pdf" width="500" height="375">
您可以像这样使用保存的pdf的相对位置:
例二
<embed src="example.pdf" width="1000" height="800" frameborder="0" allowfullscreen>
Example2
<iframe src="example.pdf" style="width:1000px; height:800px;" frameborder="0" allowfullscreen></iframe>
我发现这工作得很好,浏览器处理它在firefox。我没有检查IE…
<script>window.location='url'</script>
构造一个输入PDF字节的blob 使用跨浏览器补丁的iframe和PDF.js 解决方案
iframe的URI应该是这样的:
/viewer.html?file=blob:19B579EA-5217-41C6-96E4-5D8DF5A5C70B
现在FF, Chrome, IE 11和Edge都在iframe中显示PDF,通过URL中的标准blob URI传递。