So far i am generating a Password protected file in node by using HummusRecipe.This has been easily done with HummusRecipe.Following is the code to Encrypt the password protect any pdf file.

                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();

Now I want to decrypt the password protected pdf in another api in express.But as far i have researched there is not any decrypt method in HummusRecipe to remove the password protection in the server side.

Another option is qpdf but it's not working in Express and giving 'SPAWN' Error.

1 Answers

1
Maahi Bhat On

You can use PDF.JS in angular.