locked
How to view a pdf with download and printing limitations RRS feed

  • Question

  • User-1917797656 posted

    Hi,

    As I said in the title, I'm looking for a way to display a pdf document with limitations, the person who visits the document should not have the right to download or print the pdf file, my current code is that

    <div class="col-md-8">
                <h4>Overview </h4>
                <hr />
                <embed src="@Url.Content("~/Content/PdfFiles/"+@Html.DisplayFor(model => model.Pdf))" type="application/pdf" width="100%" height="600px" />
            </div>

    Thursday, January 17, 2019 8:27 PM

Answers

All replies

  • User475983607 posted

    khalilbnzz

    Hi,

    As I said in the title, I'm looking for a way to display a pdf document with limitations, the person who visits the document should not have the right to download or print the pdf file, my current code is that

    <div class="col-md-8">
                <h4>Overview </h4>
                <hr />
                <embed src="@Url.Content("~/Content/PdfFiles/"+@Html.DisplayFor(model => model.Pdf))" type="application/pdf" width="100%" height="600px" />
            </div>

    I'm pretty sure it is not possible to display content and disable printing or saving on the client's machine.

    Thursday, January 17, 2019 8:35 PM
  • User-893317190 posted

    Hi khalilbnzz,

    You could disable toolbar of embed using the code below.

    <embed src="@Url.Action("Pdf")#toolbar=0&navpanes=0&scrollbar=0" type="application/pdf" width="100%" height="600px" id="ifa"/>

    But the user still could  right click the element to print the pdf. Even this works, what if the user directly enter the link of your pdf?

    You could refer to the link below for more detail, it is hard to realize.

    https://stackoverflow.com/questions/51317588/need-to-block-right-click-on-pdf-angular-2

    https://stackoverflow.com/questions/10129733/embed-pdf-on-a-webpage-and-prevent-download

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 18, 2019 5:58 AM