简体   繁体   English

如何保护PDF文件不被下载或复制

[英]How to protect PDF files from being downloaded or copied

I'm developing a new website with PHP & MySQL.我正在用 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.因此,我需要确保这些书籍的 PDF 文件得到妥善保护,无法保存、下载或以任何方式复制。

How can I do that?我怎样才能做到这一点?

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

I think this is not a PHP or MYSQL solution.我认为这不是 PHP 或 MYSQL 解决方案。 PDF's have a "protected mode". PDF 具有“保护模式”。 There you can disable printing the pdf.在那里您可以禁用打印 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.您应该寻找可以在保护模式下重新创建 pdf 并为用户提供此文件的服务器端 pdf 娱乐工具。 Take a deeper look into PDF functions.深入了解 PDF 函数。 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/这里有更多信息的链接: 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.选项 1:您可以在服务器上自行处理。 Housing the PDFs outside of the public Apache directory (so there is no way a URL can reach it).将 PDF 保存在公共 Apache 目录之外(因此 URL 无法访问它)。 Then with a PHP function read the contents of the file and stream it to the browser.然后使用 PHP 函数读取文件的内容并将其流式传输到浏览器。 Streaming a large file using PHP 使用 PHP 流式传输大文件

Option 2: Use something like AWS S3.选项 2:使用类似 AWS S3 的东西。 You can lock down the bucket so there is no public access.您可以锁定存储桶,这样就没有公共访问权限。 And generate signed URLs as needed.并根据需要生成签名 URL。 They'll be unique urls which you can specify a time limit of availablity.它们将是唯一的 url,您可以指定可用的时间限制。 AWS S3 The security of a signed URL as a hyperlink AWS S3 作为超链接的签名 URL 的安全性

You can encrypt the PDF and use an embedded viewer by using the Copysafe PDF Protection software.您可以使用Copysafe PDF Protection软件加密 PDF 并使用嵌入式查看器。 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.它是唯一可以防止所有复制(包括屏幕截图)的解决方案,也是唯一可以通过 Web 浏览器在线显示的有效复制保护解决方案。 The downside is that the ArtisBrowser web browser is required which is a Windows only app.缺点是需要 ArtisBrowser 网络浏览器,这是一个仅限 Windows 的应用程序。 Mac users can run Windows from Parallels or Bootcamp. Mac 用户可以从 Parallels 或 Bootcamp 运行 Windows。

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.插件可用于流行的 CMS,如 WordPress、Drupal、Joomla 和 Moodle,用于将受保护的 PDF 上传和放置到网页和来自内联编辑器的帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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