如何在服务器端通过HummusRecipe对PDF文件进行Dcypt


到目前为止,我正在使用HummusRecipe

在节点中生成一个受密码保护的文件.这已经很容易用HummusRecipe完成。

                const localFilePath = files.clientDoc.path;
                const outputFilePath = `${process.cwd()}/logs/temp.pdf`;
                const pdfDoc = new HummusRecipe(localFilePath, outputFilePath);
                pdfDoc
                    .encrypt({
                        userPassword: '123',
                        ownerPassword: '123',
                        userProtectionFlag: 4
                    }).endPDF();

现在我想在另一个 api 中解密受密码保护的 pdf 快递。但据我研究,HummusRecipe 中没有任何解密方法来删除服务器端的密码保护。

另一种选择是qpdf,但它在Express中不起作用并给出"SPAWN"错误。

您可以使用 PDF.JS 以角度显示。

最新更新