locked
Disable PDF download/printing/clicking from FileResult RRS feed

  • Question

  • User-1843979153 posted

    I am using FileResult to return a PDF.

    My code works but is there a way to disallow users to download/print and click (copy the words) from the PDF?

    Saturday, January 30, 2021 11:32 AM

All replies

  • User-1545767719 posted

    tanws8

    My code works but is there a way to disallow users to download/print and click (copy the words) from the PDF?

    As far as the “download” is concerned you will be able to provide the authentication and authorization mechanism in your MVC application to allow only the users who have been authenticated and authorized. Probably it is only what ASP.NET MVC can do.

    After a user has successfully completed the download of PDF file in his PC, however, there will be nothing ASP.NET MVC can do for the downloaded PDF file. If you want to disallow “print” and “click” the original PDF must have such provisions.

    Sunday, January 31, 2021 1:39 AM
  • User571301025 posted

    When you show the PDF as the final one you can't restrict the download. However, you can difficult the process like you can show the pdf in some other pdf viewers like js pdf viewers.

    And regarding to avoid the copy the text you can try to flatten the PDF stream just before to sent the Response stream. Otherwise you can try to convert the entire PDF as a image and render to the user, which will hopefully a better solution for you.

    You didn't specify the API you are using for PDF. iTextSharp for .Net is the clear winner go with it.

    Let me know if you have any further clarifications.

    Hop this helps!

    Monday, February 1, 2021 8:11 PM