Disable right click in a PDF file opened in IFRAME

I want to open a pdf on click of a link in ASP.NET and user shouldn’t be able to copy/paste/print any info in pdf. To achieve this I am trying to open the pdf in an iframe so that I can disable the menu bar, navigation bars of pdf but when user do a right click on pdf print option is visible!! how to avoid this or is there any way to achieve this using any other file format??
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sean ScissorsProgram Analyst IICommented:
There is one problem with this idea. You are upset about the print option being available...however even if you disable the right click they can still print it with "Print_Screen". All PDF is anyways is basically an image unless it has searchable text. Even still, if it is on a website they will be able to print it out. There's no way of stopping that. By disabling the right click you will make it harder but still not fully prevent it.
WayneFeraeraAuthor Commented:

Thank you for attending my query.

I have seen many online video training web sites like appdev.com, who have their own course material in PDF format.
And in side PDF, we cant print,copy, paste etc. I would like to know, how they have achieved this.

Sean ScissorsProgram Analyst IICommented:
Well the main idea is to disable access to the "context menu" which is what shows when you right click. This can usually be achieved using some javascript but it isn't very simple or very common. When it comes to online information, if it's well online then it can be copied in some way shape or form, whether it's meant to be or not.

Not to mention if you are trying to have the PDF in an IFRAME and make it disable the context menu, I don't believe that in itself is even possible on an external site. I did a little research and heard things that it's not possible and even if it is it's bad etiquette to do so. I can try and help you find some code to do it but again I feel it really is not worth it. With websites, even regarding important information, it's never a good idea to take away abilities from the user. It can deter them from your site if the ease of use is difficult or unusual.

That's my 2 cents.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

WayneFeraeraAuthor Commented:

The implementation what i am trying for, is not to take away abilities from user. It is to ensure, users wont download corporate PDF files onto their systems, as they  are only supposed to read what is in PDF.

In this context, it is very ,important for me, to take away such actions.

Sean ScissorsProgram Analyst IICommented:
Well one suggestion I found is a work-around. You want them to not be able to download or probably print the PDF. Instead of disabling right click you can do the following..

When you create the PDF,

    set an admin password
    set an EMPTY user password
    set printing document permission to false

However if you are determined to try and disable right-click there is code below that works but I don't know if it will work since you are rendering the PDF within an Iframe.


Good luck.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WayneFeraeraAuthor Commented:
We are clients to a company, obviously company will not give us permissions to set permissions on their PDF files.

As per his comment, I have only advised client to set permissions by him self, thus printing will be disabled.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.