Encryption and permissions
Let users encrypt PDFs with AES-256 and permissions, remove passwords, and add watermarks, headers, footers and Bates numbers in an Electron window with NexPDF.
License module
Encrypting, removing passwords, watermarks, headers, footers and Bates numbering need the security
module (Startup tier and above). Opening encrypted files works without a key.
Open an encrypted PDF
When the user opens a password-protected file with the window's own Open button, the window asks for the password. The user (open) password or the owner password both work.
From code, pass the password: openPdfWindow({ file, password }), pdf.open(file, { password }) or
openDocument(engine, bytes, name, { password }) (1.0.1 and later). The File, Open… menu item
sends no password, so an encrypted file opened with it fails to open. See
Opening and saving.
The Protect mode
The Protect mode (security) has:
| Tool | What it does |
|---|---|
| Encrypt | Encrypts with AES-256: an open password, a permissions password, and whether printing, copying and editing are allowed |
| Remove password | Saves the document without encryption |
| Watermark | Adds a text watermark, or removes all NexPDF watermarks |
| Header & footer | Adds a header and footer to every page |
| Bates numbering | Numbers every page with a prefix |
| Document properties | Edits the title, author, subject and keywords |
| ISO standards | Converts to PDF/A, PDF/UA, PDF/X, PDF/E or PDF/VT; see PDF/A and PDF/UA |
| Color separation | Previews the cyan, magenta, yellow and black plates and measures ink coverage |
Offer it
{ "modeConfig": { "availableModes": ["viewer", "security"] } }Pass the configuration as the path of a JSON file; see Viewing pages.
From code
To encrypt or stamp documents in code, use the document API
(openDocumentFile, then the calls of the Node.js SDK).