PdfEncryptionDetails Class

Contains details for a PDF encryption.
Inheritance Hierarchy
SystemObject
  Aspose.Tasks.SavingPdfEncryptionDetails

Namespace:  Aspose.Tasks.Saving
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 20.5
Syntax
public class PdfEncryptionDetails

The PdfEncryptionDetails type exposes the following members.

Constructors
  NameDescription
Public methodCode examplePdfEncryptionDetails
Initializes a new instance of the PdfEncryptionDetails class.
Properties
  NameDescription
Public propertyCode exampleEncryptionAlgorithm
Gets or sets the encryption mode.
Public propertyCode exampleOwnerPassword
Gets or sets the Owner password.
Public propertyCode examplePermissions
Gets or sets the permissions.
Public propertyCode exampleUserPassword
Gets or sets the User password.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to use specify PDF encryption details while saving a project as PDF file.
var project = new Project(DataDir + "CreateProject2.mpp");

// lets specify encryption details  
var encryptionDetails = new PdfEncryptionDetails(
    // specify user password
    "userPassword", 
    // specify owner password
    "ownerPassword", 
    // specify encryption algorithm
    PdfEncryptionAlgorithm.RC4_128);

// specify permissions
encryptionDetails.Permissions = PdfPermissions.ModifyContents | PdfPermissions.ModifyAnnotations;

// show user and owner passwords
Console.WriteLine("User Password: " + encryptionDetails.UserPassword);
Console.WriteLine("Owner Password: " + encryptionDetails.OwnerPassword);
// show encryption mode: RC4_40 or RC4_128
Console.WriteLine("Encryption Algorithm: " + encryptionDetails.EncryptionAlgorithm);
Console.WriteLine("Permissions: " + encryptionDetails.Permissions);

var options = new PdfSaveOptions
{
    EncryptionDetails = encryptionDetails
};

// save the project with specified encryption details
project.Save(OutDir + "WorkWithPdfEncryptionDetails_out.pdf", options);
See Also