Create and Open Encrypted PDFs Using JavaScript
The easiest way to securely transfer your PDF is to serve it through HTTPS. This way, the browser will take care of decrypting the secured communication for you.
Additionally, you can encrypt the PDF’s content on the server using your own custom encryption. When you fetch the encrypted PDF, decrypt the data in the browser into an ArrayBuffer
. Then pass it to PSPDFKit’s load
method, and it’ll render your document:
const instance = PSPDFKit.load({
...myOtherConfigOptions,
document: myDecryptedArrayBuffer
});