2013-02-14 66 views
0

我是網絡編程的初學者,我的問題是如何將pdf文檔嵌入到html一個分區標記中,並且該pdf可以避免複製,打印和下載選項。如何在HTML中嵌入PDF文檔與出版副本和打印

以下是我的代碼。

<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> 
+0

看到了這一點? http://stackoverflow.com/questions/291813/recommended-way-to-embed-pdf-in-html – 2013-02-14 10:33:35

+0

在這個鏈接我找不到如何避免複製和打印 – vikram 2013-02-14 10:36:46

回答

0

一些選項可幫助您:

第一:

如果你堅持使用PDF內嵌選項,PDF文件看起來不那麼大的網頁上。無論如何,一定要嚴格編碼。因此:

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

應該

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

二:

您也可以使用谷歌的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庫。這是一個用於PDF文檔的純HTML5/JavaScript渲染器,沒有任何第三方插件。

在線演示: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?