使用js文件
js文件下载链接:https://github.com/pipwerks/PDFObject/
样例:
1. Create a container to hold your PDF
<div id="example1"></div>
2. Tell PDFObject which PDF to embed, and where to embed it
<script src="/js/pdfobject.js"></script>
<script>PDFObject.embed("/pdf/sample-3pp.pdf", "#example1");</script>
3. You can optionally use CSS to change the appearance of the containing element, such as height, width, border, margins, etc.
<style>
.pdfobject-container { height: 30rem; border: 1rem solid rgba(0,0,0,.1); }
</style>
不用js文件
Embedding PDFs without using JavaScript
博主使用这种方法显示不出来,可以参考
第一种
<embed src="../pdf/sample-3pp.pdf#page=2" type="application/pdf" width="100%" height="100%">
第二种
<iframe src="../pdf/sample-3pp.pdf#page=2" width="100%" height="100%">
This browser does not support PDFs. Please download the PDF to view it:
<a href="../pdf/sample-3pp.pdf">Download PDF</a></iframe>
第三种
<object data="../pdf/sample-3pp.pdf#page=2" type="application/pdf" width="100%" height="100%">
<p><b>Example fallback content</b>: This browser does not support PDFs. Please download the PDF to view it:
<a href="../pdf/sample-3pp.pdf">Download PDF</a>.</p>
</object>
个人微信公众号,专注于学习资源、笔记分享,欢迎关注。我们一起成长,一起学习。一直纯真着,善良着,温情地热爱生活,,如果觉得有点用的话,请不要吝啬你手中点赞的权力,谢谢我亲爱的读者朋友。
Maybe sometimes it’s easier to be mad at the people you trust, because you know they’ll always love you, no matter what.
有时候我们更容易对我们相信的人生气,因为你知道不管怎样他们都会永远爱你。
2020年3月31日于重庆城口
好好学习,天天向上,终有所获