2017-03-07 29 views
1

我已經使用標籤來顯示文檔(文件)。在該PDF文件顯示打印和下載選項我需要刪除PDF瀏覽器中的打印和下載選項是否有任何方法來隱藏它。在pdf查看器中禁用複製和打印選項

下面是我的HTML代碼,查看PDF文檔

<iframe class="iframemargins" src="{{ url('uploads/chapters/Author.pdf') }}" 
 
     title="PDF in an i-Frame" frameborder="0" scrolling="auto" width="100%" 
 
     height="600px"> 
 
</iframe>

是否有任何其他的方式來顯示,如PDF,DOC,TXT,RTF文件。

回答

0

使用PDF.js爲您提供了PDF查看器的來源。只需從web/viewer.html中刪除這些按鈕。

請注意,您的網址將不得不改變,以web/viewer.html?file={{ url('uploads/chapters/Author.pdf') }}作爲指定here


要查看MS Office文檔,使用類似Zoho

+0

如何使用pdf.js文件我需要文檔 – Vinothini

+0

@Vinothini而不是直接鏈接到PDF本身,通過'file'參數將iframe鏈接到您的viewer.html頁面 – Justinas

+0

我有我的答案見下面 – Vinothini

0

可以使用印刷媒體查詢隱藏元素打印。看下面的例子。

var btn = document.getElementById("print"); 
 
btn.addEventListener("click", function(){ 
 
    window.print(); 
 
});
@media print { 
 
    .print { 
 
     display: none; 
 
    } 
 
}
<h3 style='text-align: center'>My Table</h3> 
 
<table border='1' style='border-collapse: collapse; width: 100%;'> 
 
<thead> 
 
    <tr> 
 
    <th>Heading 1</th> 
 
    <th>Heading 2</th> 
 
    <th>Heading 3</th> 
 
    </tr> 
 
</thead> 
 
<tbody> 
 
    <tr> 
 
    <th>Value 1</th> 
 
    <th>Value 2</th> 
 
    <th>Value 3</th> 
 
    </tr> 
 
    <tr> 
 
    <th>Value 1</th> 
 
    <th>Value 2</th> 
 
    <th>Value 3</th> 
 
    </tr> 
 
    <tr> 
 
    <th>Value 1</th> 
 
    <th>Value 2</th> 
 
    <th>Value 3</th> 
 
    </tr> 
 
    <tr> 
 
    <th>Value 1</th> 
 
    <th>Value 2</th> 
 
    <th>Value 3</th> 
 
    </tr> 
 
</tbody> 
 
</table> 
 
<button class='print'>Download</button> 
 
<button class='print' id='print'>Print</button>

+0

這不是我想要的實際上我需要顯示PDF文件沒有打印和下載選項使用iframe標記 – Vinothini

+0

您的意思是隱藏瀏覽器打印預覽的下載和打印選項? – Muhammad

+0

不,文檔查看器在html元素中使用iframe – Vinothini

0

我發現了一個解決方案......這裏是我得到的解決方案

Hiding the toolbars surrounding an embedded pdf?

的鏈接,我已經更新了我的html代碼和其工作

<iframe src="{{ url('uploads/chapters/Author.pdf') }}#toolbar=0&navpanes=0&scrollbar=0" title="PDF in an i-Frame" frameborder="0" scrolling="auto" style="width:100%; height:100%;"></iframe> 
相關問題