0

我是网络编程的初学者,我的问题是如何将 pdf 文档嵌入到 html 一个部门标签中,并且我们可以避免复制、打印和下载选项。

以下是我的代码。

<html>
  <head>
    <title>Pdf Document
    </title>
  </head>
  <body>
    hello world!
      <br>
        <div width="500px" height="500px">

          <embed src="myfile.pdf#toolbar=0&navpanes=0&scrollbar=0" width="425" 

            height="425">
          </div>
          <div width="1px"> hello</div>
        </body>
      </html>
4

1 回答 1

0

一些选项可能会帮助你:

第一的:

如果您坚持使用 pdf 嵌入选项,则 Pdf 文件在网页上看起来不会那么好。无论如何,一定要严格编码。因此:

<iframe src="path/to/pdf" width=500 height = 500>

应该

<iframe src="path/to/pdf" width="500" height="500">

第二:

为此,您还可以使用 Google PDF 查看器。

您需要先在某处上传您的 PDF,然后使用它的 URL:

<iframe src="http://docs.google.com/gview?url=http://example.com/mypdf.pdf&embedded=true"  style="width:500px; height:500px;" frameborder="0"></iframe>

第三:

最好的方法是使用 PDF.JS 库。它是一个纯 HTML5/JavaScript 的 PDF 文档渲染器,没有任何第三方插件。

在线演示: http: //mozilla.github.com/pdf.js/web/viewer.html

GitHub:https ://github.com/mozilla/pdf.js

链接:

将 PDF 嵌入 HTML 的推荐方法?

如何在网站中嵌入 PDF 文件?

于 2013-02-14T10:44:20.283 回答