Encrypts a PDF with a password in the browser using the standard security handler — AES-256 by default, with AES-128 and RC4 available for older readers. Set an open password (needed to view the file), an owner password (needed to change permissions), or both, and choose what readers may do. Permission flags are advisory: conforming readers honour them, but only the password actually keeps the document closed, and nothing here can recover a forgotten one.
Replace the sample password before you share the file.