简体   繁体   中英

How to protect PDF files from being downloaded or copied

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?

我建议您将 PDF 转换为图像,并显示第一页或根据需要查看此库,它可能很有用Imagemagick

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/

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

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.

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