Click here to Skip to main content
14,430,298 members
Rate this:
Please Sign up or sign in to 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....
Posted
Updated 19-Nov-19 7:12am
Comments
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.
Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

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.
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100