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

Last Reply one year ago By dharmendr

Posted one year 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

You are viewing reply posted by: dharmendr one year ago.
Posted one year 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.

HTML

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

C#

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";
}

Screenshot