admin管理员组文章数量:1355589
I have a web service which will return pdf stream for a given document id and I will set the content type to application/pdf and write the out put to IFRAME upto this point I am done and OK! My problem is : My requirement is to disable the pdf download toolbar button in IFRAME, is there any way using JavaScript or j query to disable the PDF toolbar buttons, i tried some thing like this:
<iframe src="view/1.pdf?page=hsn#toolbar=0" width="875" height="95%" id="iframe11">
<p>Your browser does not support iframes.</p>
</iframe>
I tried setting toolbar=0 for iframe tag but it dint work. an anyone please tell me how to achieve this ?
I have a web service which will return pdf stream for a given document id and I will set the content type to application/pdf and write the out put to IFRAME upto this point I am done and OK! My problem is : My requirement is to disable the pdf download toolbar button in IFRAME, is there any way using JavaScript or j query to disable the PDF toolbar buttons, i tried some thing like this:
<iframe src="view/1.pdf?page=hsn#toolbar=0" width="875" height="95%" id="iframe11">
<p>Your browser does not support iframes.</p>
</iframe>
I tried setting toolbar=0 for iframe tag but it dint work. an anyone please tell me how to achieve this ?
Share Improve this question asked Dec 2, 2013 at 12:51 abhiabhi 8205 gold badges17 silver badges29 bronze badges 3-
2
The toolbar you're referring to is most likely a built-in or external plugin used by the browser for displaying PDF files. You cannot disable it, as it's not part of the
iframe
. – Boaz Commented Dec 2, 2013 at 12:56 - 2 You can't control that, since it's a browser feature. You should go for something like googlesystem.blogspot..br/2009/09/… – rafaelcastrocouto Commented Dec 2, 2013 at 13:00
- hey did you solved your problem need help with that? – JAVA_RMI Commented Feb 9, 2017 at 9:01
3 Answers
Reset to default 2I hope I am not very late to reply. But here's is something you can do to prevent the users. Use iFrame to display your PDF and make sure that you are displaying using Google. I used the following code :
<iframe src="http://docs.google./gview?url=http://www.tutorialspoint./php/php_tutorial.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0">
</iframe>
Here you can simply change the url=http://www.tutorialspoint./php/php_tutorial.pdf
and replace it by your own URL where you kept your PDF.
Use embed tag instead iframe tag:
<embed src="http://localhost/yourpdf.pdf#toolbar=0" style="width:600px; height:500px;">
Only download and print button cannot be hidde. Either you can hide whole toolbar ( using #toolbar=0) or keep all. Here is what i did to only these buttons:
<div class="position-relative" style="height: 95%">
<embed src="assets/your-pdf.pdf" width="100%" height="100%"></embed>
<div class="testttt"></div>
</div>
and here is styling:
.testttt{
height: 40px;
width: 200px;
background-color: #323639;
position: absolute;
right: 0;
top: 10px;
z-index: 9999999999999999999999;
}
Boom you got download and print button hidden.
本文标签: javascriptHow to disable pdf toolbar download button in iframeStack Overflow
版权声明:本文标题:javascript - How to disable pdf toolbar download button in iframe - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743949198a2566970.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论