-2

I'm rendering one PDF in my website using the Canvas so that the user can view but not download. I have disabled the right click and the disable the download button and disable the printout too on any of the browsers. However there are still ways to get into the F12 mode and get the PDF downloaded. IF any one can help to achieve my logic to disable the developer mode on that particular webpage. Thanks in advance.

  • 2
    Hate to break it to you but if the user is viewing anything in their browser, they have already downloaded it – Phil Dec 02 '20 at 04:23

1 Answers1

2

Even if you could, it won't matter.

The pdf document data, unless generated by your client, has been downloaded, which means even if a website had control over a client's dev tools (which it does not), the client could just intercept all the packages containing your file going to his machine.

Artur
  • 334
  • 5
  • 15
  • thanks for the comment. Do you have any other idea to achieve this?. What I want is I want the user to just view the PDF nothing else in my web. Im using PHP with Javascript. – Lonely Planet Dec 02 '20 at 04:36
  • 1
    You have no control on what is happening outside of your website on a user's machine. One thing you could try, assuming it's not the pdf contents, but the document itself that you are trying to protect (because a user could simply take screenshots of your pdf anyway), is to have a backend that will supply *images* of your pdf document's pages to your client. – Artur Dec 02 '20 at 04:40
  • [Here](https://stackoverflow.com/questions/467793/how-do-i-convert-a-pdf-document-to-a-preview-image-in-php) is a link on how to make images out of your pdf using PHP – Artur Dec 02 '20 at 04:42