How to protect PDF files from being downloaded or

2020-04-26 23:30发布

I'm developing a new website with PHP & MySQL.

The website is for an online eBook library that grant access to its books based on paid subscription plans.

So, I need to make sure the PDF files of these books are well protected and can't be saved, downloaded, or in anyway copied.

How can I do that?

4条回答
啃猪蹄的小仙女
2楼-- · 2020-04-27 00:12

I suggest you to convert the PDF into an image , and display the first page or as you like, check this library it can be useful Imagemagick

查看更多
兄弟一词,经得起流年.
3楼-- · 2020-04-27 00:15

You can encrypt the PDF and use an embedded viewer by using the Copysafe PDF Protection software. It is the only solution that is safe from all copy including screen capture, and the only effective copy protection solution that can be displayed online via a web browser. The downside is that the ArtisBrowser web browser is required which is a Windows only app. Mac users can run Windows from Parallels or Bootcamp.

Plugins are available for popular CMS like WordPress, Drupal, Joomla and Moodle for uploading and placement of the protected PDF onto web pages and posts from the inline editor.

查看更多
一夜七次
4楼-- · 2020-04-27 00:18

I think this is not a PHP or MYSQL solution. PDF's have a "protected mode". There you can disable printing the pdf. You should look for a server side pdf recreation tool that can recreate the pdf in protected mode and serve the user this file. Take a deeper look into PDF functions. I think i can remember that there should also a trial mode also and the ability to view only on 1 device. Here a link for more info: http://www.dummies.com/software/adobe/acrobat/restrict-who-can-edit-or-print-pdf-documents/

查看更多
Root(大扎)
5楼-- · 2020-04-27 00:22

You'll be able lock down the files from unwanted downloads. But redistribution or sharing login details will be a battle.

Some options I can think of

Option 1: You can handle this yourself on the server. Housing the PDFs outside of the public Apache directory (so there is no way a URL can reach it). Then with a PHP function read the contents of the file and stream it to the browser. Streaming a large file using PHP

Option 2: Use something like AWS S3. You can lock down the bucket so there is no public access. And generate signed URLs as needed. They'll be unique urls which you can specify a time limit of availablity. AWS S3 The security of a signed URL as a hyperlink

查看更多
登录 后发表回答