PdfEncryptionDetails.UserPassword

PdfEncryptionDetails UserPassword property. Specifies the user password required for opening the encrypted PDF document.

PdfEncryptionDetails.UserPassword property

Specifies the user password required for opening the encrypted PDF document.

public string UserPassword { get; set; }

Remarks

The user password will be required to open an encrypted PDF document for viewing. The permissions specified in Permissions will be enforced by the reader software.

The user password can be null or empty string, in this case no password will be required from the user when opening the PDF document. The user password cannot be the same as the owner password.

Examples

Shows how to specify PDF document encryption details.

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.EncryptionDetails = new PdfEncryptionDetails("userPass", "1234", PdfPermissions.Printing);

// Change permissions and password after creation of PdfEncryptionDetails object.
pdfSaveOptions.EncryptionDetails.OwnerPassword = "12345";
pdfSaveOptions.EncryptionDetails.UserPassword = "123";
pdfSaveOptions.EncryptionDetails.Permissions = PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly;

Converter.Create()
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "PdfSaveOptions.EncryptionDetails.pdf", pdfSaveOptions)
    .Execute();

See Also