您可以将 PDF 文档嵌入到 HTML 中的 <object> 标记中
<object data="/document.pdf" 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="http://www.example.com/document.pdf">Download PDF</a>.</p>
或者您可以使用<embed> 方法
<embed src="/pdf/sample-3pp.pdf#page=2" type="application/pdf" width="100%" height="100%">
也许在iframe
<iframe src="/document.pdf" width="100%" height="100%">
This browser does not support PDFs. Please download the PDF to view it: <a href="/document.pdf">Download PDF</a>
</iframe>
您需要将这些标签中的任何一个放置在您的HTML 页面的<Body> 标签中。
<HTML>
<HEAD>
<TITLE>Example PDF Page</TITLE>
</HEAD>
<BODY>
<!- This is a HTML comment, replace me with your embedding choice ->
</BODY>
</HTML>
覆盖最多用户的首选方法是使用 object 和 iframe 后备
<object data="/document.pdf" type="application/pdf" width="100%" height="100%">
<iframe src="/document.pdf" width="100%" height="100%" style="border: none;">This browser does not support PDFs. Please download the PDF to view it: <a href="/document.pdf">Download PDF</a>
</iframe>
</object>
如需现场演示和致谢,您可以在 PDFObject 看到它的实际效果