You must Sign In to post a response.
  • Category: ASP.NET

    Disable Copy,RightClick,Save and Print in pdf

    Hi Friends,

    I am Displaying one pdf file in i have a requirement to disable right click, save,copy and print option of that pdf document. please help me to fix this.

    Thank you
  • #763975
    1. Open the PDF in the aspx page
    2. You can try to open that using the

    Following is the sample code

    function openWin(PageP) {
    myWindow =, PageP, 'height=750,width=1200,toolbar=no,directories=no,status=no, linemenubar=no,scrollbars=no,resizable=no ,modal=yes');

    3. Also you can handle the key press using javascript

    By Nathan
    Direction is important than speed

  • #763979

    You can go through below piece in javascript include your page try them

    this is the code

    <script language="javascript">
    function disableclick(event)
    return false;

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #763995
    Hai Ambika,
    If you are using the iTextSharp to generate the pdf, then there are few method parameters to restrict the save, edit etc.
    Below is the link where you can find the method to use it:

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • #765496
    I searched the internet and found the following forums that discuss a similar requirement

  • #765499
    PDF document has its own security features to disable copy/paste and print option but you need to use some API to deal with PDF security settings, once the settings are applied then you open PDF in any editor, it will show you effect
    Good way to do it using iTextSharp see below snippet

    PdfReader reader = new PdfReader("my-old-file.pdf");
    PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("my-new-file.pdf"));
    stamper.setEncryption("my-owner-password".getBytes(), "my-user-password".getBytes(),
    PdfWriter.AllowPrinting | PdfWriter.AllowCopy, PdfWriter.STRENGTH40BITS);

    Here is additional link that might help you

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • Sign In to post your comments