【问题标题】:how embed pdf document in html with out copy and print如何在不复制和打印的情况下将pdf文档嵌入html
【发布时间】:2013-01-30 03:01:02
【问题描述】:

我是网络编程的初学者,我的问题是如何将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>

【问题讨论】:

标签: html pdf


【解决方案1】:

一些选项可能对您有所帮助:

第一:

如果您坚持使用 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

链接:

Recommended way to embed PDF in HTML?

How to embed a PDF file in a web site?

【讨论】:

    猜你喜欢
    • 2023-03-11
    • 2014-08-28
    • 1970-01-01
    • 2011-01-04
    • 1970-01-01
    • 1970-01-01
    • 2013-06-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多