๐ Encryption
Password-protected PDFs with AES-256 encryption and granular permission control.
C# โ Encrypted PDF
doc.Encryption = new PdfEncryption
{
// Empty = anyone can open
UserPassword = "",
// Full-access password
OwnerPassword = "AdminPass123",
// Strongest encryption
Algorithm = PdfEncryptionAlgorithm.Aes256,
// Granular permissions
AllowPrinting = true,
AllowCopying = false,
AllowModifying = false,
AllowAnnotating = true
};
You should see an "Encrypted Document" heading and a four-line paragraph describing the AES-256 settings (open without a password; copying and modifying restricted; owner password required for full access). Check Document Properties โ Security in your viewer to confirm the permissions and encryption algorithm.
File: 11_encryption.pdf
Encryption Options
| Property | Description |
|---|---|
Algorithm | Aes128 or Aes256 |
UserPassword | Password to open the PDF (empty = no password needed) |
OwnerPassword | Password for full access (change permissions, etc.) |
AllowPrinting | Allow readers to print |
AllowCopying | Allow copy/paste of text |
AllowModifying | Allow document editing |
AllowAnnotating | Allow adding comments |