Disable Save Print Right Click options from PDF Viewer in ASP.Net

Last Reply 10 months ago By dharmendr

Posted 10 months ago

hi , developers 

am creating a website for online examination. now i need to display answer with detailed explanation pdf on my web page inside iframe tag.

How to Disable Save, Print, Ctrl+S, Right Click options

i have done well

below is my code, but that is not working

pdfiframe.Attributes["src"] = "http://docs.google.com/gview?url=http://tutelagelabs.com/student/Learning/EX-CH12-U10-C02-Q-018 Ans.pdf&embedded=true&toolbar=0&navpanes=0";

so there is any other way to do this only, embed or object reader

Posted 10 months ago

Hi paulrajmca,

iFrame is used to display the pdf in browser. Save, Print, Rightclick are the inbuilt functionality of PDF viewer. You can't disable those. These are handled by the browser itself and different for each browser.

What you can do is you can hide the toolbar by setting the below properties.

toolbar = 0 : Hides the Toolbar

navpanes = 0 : Hides the Navbar

scrollbar = 0 : Hides the Scrollbar

Like in the below example.

<iframe frameborder="1" src="Test.pdf#toolbar=0&navpanes=0" width="1000" height="750">

For a full list of parameters refer the below link.


Posted 10 months ago

Hi paulrajmca,

You have not assigned the correct src property. After the pdf file name with extension you need to add # with parameter and then you can add additional parameter with &.

Check the below example.


<iframe runat="server" id="pdfiframe" frameborder="1" src="" width="300" height="300">


protected void Page_Load(object sender, EventArgs e)
    string pdfUrl = "http://tutelagelabs.com/student/Learning/EX-CH12-U10-C02-Q-018 Ans.pdf";
    pdfiframe.Attributes["src"] = pdfUrl + "#embedded=true&toolbar=0&navpanes=0";