更新 PDF 以包含加密的、隐藏的、唯一的标识符?

发布于 2024-10-08 22:24:48 字数 1452 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神爱温柔 2024-10-15 22:24:48

我已经使用 PDFlib 为另一个项目完成了此操作。我们需要对生成的 PDF 进行追踪,以防文件泄露。基本上:

  1. 创建一个包含内容的源模板 PDF,使用所需的选项(无编辑、无打印、无屏幕阅读器等)设置文档主密码。
  2. 在运行时,我们应用了一些水印(强加)页面页脚显示“此文档已由用户 #12345 签出”,设置一些元数据字段,包括用户 ID、下载 IP、下载日期/时间,添加“此文档版权归...”封面页等。 .)
  3. 可以选择附加用户密码,以在打开文档时强制显示密码提示。

由于最新的 PDF 版本使用 AES-128 进行加密,我们只需设置一个合适的随机生成的 128 字符高熵密码 - 没有人会手动输入它,因此难以输入与我们无关,实际上更可取。主密码阻止最终用户对文档进行任何更改。各种无打印/无屏幕阅读选项实际上是由 PDF 阅读器强制执行的,因此可以绕过,但无论如何设置它们也没有什么坏处。

这样做的缺点是 PDFlib 的许可相当严格。我不知道是否有任何免费的 php PDF 库支持最新的 PDF 加密方案,尤其是主密码,但如果您的预算可以支持,那么 PDFlib 是安全文档生成的最佳选择。

I've done this for another project with PDFlib. We needed traceability for the generated PDFs in case the file was leaked. Basically:

  1. Created a source template PDF with the content in place, set the document master password with the required options (no edit, no print, no screen-reader, etc...) set
  2. At runtime, we applied a few watermarks (imposed page footer saying "This document checked out to user #12345", set a few of the metadata fields with user ID, download IP, download date/time, added a "this document copyright by..." cover page, etc...)
  3. Optionally attach a user password to force a PW prompt when document is opened.

Since the latest PDF versions use AES-128 for their encryption, we just set a suitable randomly generated 128char high-entropy password - no one would ever be typing it in by hand so hard-to-typedness was irrelevant to us and actually preferable. The master password prevented end-users from making any changes to the document. The various noprint/no screen read options are actually enforced by the PDF reader and therefore bypassable, but can't hurt to set them anyways.

The downside to this is that PDFlib's licensing is fairly steep. I don't know if any of the free php PDF libraries support the latest PDF encryption schemes, especially the master password stuff, but if you budget can support it, PDFlib's the way to go for secure document production.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文