com.aspose.words
Class PdfEncryptionAlgorithm

java.lang.Object
    extended by com.aspose.words.PdfEncryptionAlgorithm

public class PdfEncryptionAlgorithm 
extends java.lang.Object

Utility class containing constants. Specifies the encryption algorithm to use for encrypting a PDF document.

Example:

Shows how to set permissions on a saved PDF document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.writeln("Hello world!");

PdfEncryptionDetails encryptionDetails =
    new PdfEncryptionDetails("password", "", PdfEncryptionAlgorithm.RC_4_128);

// Start by disallowing all permissions.
encryptionDetails.setPermissions(PdfPermissions.DISALLOW_ALL);

// Extend permissions to allow the editing of annotations.
encryptionDetails.setPermissions(PdfPermissions.MODIFY_ANNOTATIONS | PdfPermissions.DOCUMENT_ASSEMBLY);

// 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.setEncryptionDetails(encryptionDetails);

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

Field Summary
static final intRC_4_40 = 0
           RC4 encryption, key length of 40 bits.
static final intRC_4_128 = 1
           RC4 encryption, key length of 128 bits.
 

Field Detail

RC_4_40 = 0

public static final int RC_4_40
RC4 encryption, key length of 40 bits.

RC_4_128 = 1

public static final int RC_4_128
RC4 encryption, key length of 128 bits.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.