如何在iframe中禁用pdf工具栏下载按钮

时间:2013-12-02 12:51:05

标签: javascript jquery pdf

我有一个Web服务,它将返回给定文档ID的pdf流,我将内容类型设置为application / pdf并将输出写入IFRAME,直到此时我已经完成并且正常! 我的问题是: 我的要求是禁用IFRAME中的pdf下载工具栏按钮,有没有办法使用JavaScript或j查询来禁用PDF工具栏按钮, 我尝试过这样的事情:

<iframe src="view/1.pdf?page=hsn#toolbar=0" width="875" height="95%" id="iframe11">
     <p>Your browser does not support iframes.</p>
     </iframe>

我尝试为iframe标签设置toolbar = 0,但是它有效。 有谁请告诉我如何实现这个目标?

2 个答案:

答案 0 :(得分:3)

我希望我回复的时间不是很晚。但是,这是你可以做的事情,以防止用户。使用iFrame显示PDF并确保使用Google进行显示。我使用了以下代码:

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

在这里,您只需更改url=http://www.tutorialspoint.com/php/php_tutorial.pdf并将其替换为您保存PDF的自己的网址。

答案 1 :(得分:3)

使用embed标签代替iframe标签:

<embed src="http://localhost/yourpdf.pdf#toolbar=0" style="width:600px; height:500px;">
相关问题