

In the end, I have to save the encrypted PDF file to the local disk and load it back as a Buffer (Extremely inefficient). However, it does not support output as Buffer (as of this writing). The notable candidate is hummusRecipe (Mostly written in C/C++). I thought it would be a straightforward task to implement it since there are probably plenty of libraries in NPM that are capable of this functionality.įor the sake of simplicity, password protection and encryption is used interchangeably in this article.Īfter half a day of searching, I realize that not many libraries support modifying existing PDF files, let alone encryption features. I was tasked with adding this feature to our existing backend that uses Express. At work, a requirement to password protect existing PDF files came up.
