Click here to Skip to main content
15,917,176 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Need to Disable Download and Print option from iframe PDF viewer. Please help me to sort out this issue

What I have tried:

I tried but they given solution only for licensed PDF Viewer like Rad PDF....
Updated 19-Nov-19 6:12am
F-ES Sitecore 19-Nov-19 6:42am    
If the viewer you are using doesn't support it then there is nothing you can do. If the PDF is in my browser then it's already in my temp folders so I can copy it from there, load it into any viewer I want and print away. The reason you're not finding an answer to your problem is because there isn't one.

Apart from what F-ES Sitecore has said, your users can always take screenshots of the file if you lock other options like mouse right-click or iframe save. Then a simple OCR can provide all the content in that PDF. A few years back when I was working on a similar approach I disabled the mouse right-click to prevent most actions using JavaScript — same for CTRL + P etc. But this leads to a poor UX for the users. Here is the link for that answer; html - Protect image download - Stack Overflow[^], although this is for images but the concept is same for other files too.

A good approach is to trust the users with the content and do not expect anything else, and I highly recommend letting the users download or print the PDF because that way they trust your website and are likely to return and support your business model.

You can try to authorize the users before rendering the PDF file so that you know who is reading the content. This also depends on the PDF viewer that you are using and you might be able to use JavaScript to disable the save button, but like F-ES Sitecore said the PDF file is already on the machine, and, — wait for it... — you would need to encrypt the file using certificates or other algorithms to prevent off-site previewing.
Share this answer
You have no way of controlling this in the browser window. You also have no control over which PDF viewer is used on the client-side to display the PDF.

You CAN, however, control whether the PDF can be printed or not with the security policy in the PDF itself. Consult the documentation of the library you're using to build the PDF, if your code is generating the PDF.

But, that will not stop users from taking a screen shot of the browser window, or even just using the camera phone everyone has in their pocket now.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900