简体   繁体   English

如何在 PHP/NodeJS 中将可编辑的 PDF 转换为不可编辑的 PDF?

[英]How to convert editable PDF to non-editable PDF in PHP/NodeJS?

Problem问题

I would like to know is there any PHP/NodeJS API available to convert editable PDF to non-editable PDF online.我想知道是否有任何PHP/NodeJS API可用于在线将可编辑的 PDF 转换为不可编辑的 PDF。 We have a client application where we need a scenario where the user downloads the PDF should not able to modify it thought any software (eg. Foxit reader, Adobe)我们有一个客户端应用程序,我们需要一个场景,用户下载 PDF 应该无法修改它认为任何软件(例如 Foxit 阅读器,Adobe)

Basically, we are using PDF-LIB right now and it seems there is no solution for the non-editable pdf API to set access privileges , I have search a lot but does not found any API for that, Am not using the pdf-flatten because we want everything selectable, Appreciate your help.基本上,我们现在正在使用PDF-LIB ,似乎对于不可编辑的 pdf API 设置访问权限没有解决方案,我搜索了很多但没有找到任何 ZDB974238714CA8DE634A7CE1D08因为我们希望一切都可以选择,感谢您的帮助。

List of libraries tried and fail to achieve the results尝试并未能达到结果的库列表

  1. bpampuch/pdfmake issue can't load an existing pdf bpampuch/pdfmake问题无法加载现有的 pdf
  2. PDF-LIB issue can't support permissions PDF-LIB问题不支持权限
  3. nrhirani/node-qpdf issue File restrictions not working properly nrhirani/node-qpdf问题文件限制无法正常工作

I think flattening the PDF might help you to make it un-editable in case your target is我认为展平 PDF 可能会帮助您使其不可编辑,以防您的目标是

  • Just the form fields then you might use this from the PDF-LIB github repo只是表单字段,然后您可以从PDF-LIB github repo 使用它

  • The entire PDF then, see if pdf-flatten package helps for Node.js整个 PDF 然后,看看pdf-flatten package 是否有助于 Node.js

After a lot of research work and tried multiple libraries in PHP/Node.经过大量研究工作并在 PHP/Node 中尝试了多个库。 I don't found any library that is mature enough to proceed with that, so I decided to make an API that will build in different technology C# and Java我没有发现任何足够成熟的库可以继续进行,所以我决定制作一个 API,它将采用不同的技术 C# 和Java

Solution we post the PDF URL through API, the API download that file, and apply for multiple permission according to the dataset.解决方案我们通过API发布PDF URL,ZDB974238714CA8DE6134A7CE1D08的多个数据集申请下载。

Library the library we choose is ASPOSE我们选择的库是ASPOSE

// These can be true/false
config.IsPrint = true;

// Document is allowed to be changed.
config.IsModify = false;

// Annotation is allowed.
config.IsAnnot = true;

// Form filling is allowed.
config.IsFillForm = true;

// Content extraction is allowed.
config.IsExtract = true;

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

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