OwnerPassword

PdfEncryptionDetails.OwnerPassword property

Specifies the owner password for the encrypted PDF document.

public string OwnerPassword { get; set; }

Remarks

The owner password allows the user to open an encrypted PDF document without any access restrictions specified in Permissions.

The owner password cannot be the same as the user password.

Examples

Shows how to set permissions on a saved PDF document.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Writeln("Hello world!");

// Extend permissions to allow the editing of annotations.
PdfEncryptionDetails encryptionDetails =
    new PdfEncryptionDetails("password", string.Empty, PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly);

// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Enable encryption via the "EncryptionDetails" property.
saveOptions.EncryptionDetails = encryptionDetails;

// When we open this document, we will need to provide the password before accessing its contents.
doc.Save(ArtifactsDir + "PdfSaveOptions.EncryptionPermissions.pdf", saveOptions);

See Also