简体   繁体   中英

Disable pdf download and save option

I have a PDF file being viewed on the browser.

I want to disable Save, Download and print option of the PDF file.

Please help.

Try this:

<object width="100%" height="100%" type="application/pdf" 
data="yourpdffile.pdf#toolbar=0" id="pdf_content"><p>Document load was not 
successful.</p></object>

Make sure you add #toolbar=0 in the data attribute after your pdf file.

You can use iframe to your own version of PDF viewer.

Use pdfJS and when showing viewer.html just remove these buttons.


If user is viewing it on it's own tool, than you can't control it.

Google Drive can disable the PDF functions to download, print and copy as of 2015.

Note however, that users can still print using the browser print function.

https://gsuiteupdates.googleblog.com/2015/07/disable-downloading-printing-and.html

我通过HTML链接向公众提供了许多具有此功能的电子PDF。

As others have noted, once the pdf is being viewed by the user, they can save it.

If you are just wanting to obfuscate the download, you could disable the menu as described but to truly prevent downloading of the PDF, then only thing you could really do is a little crazy but not impossible.

You could convert it to images and show those instead. Not an ultimate solution as they would still be able to save each image, but at the very least they would not get a PDF file from it (or at least if they are smart enough to convert the images to one, it would not be the same pdf file or content)

There are many tools to do this and you'd have to implement a viewer with paging but this might achieve what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM