com.aspose.words

Class PdfEncryptionAlgorithm

  • java.lang.Object
    • 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:

Demonstrates how to set permissions on a PDF document generated by Aspose.Words.
Document doc = new Document(getMyDir() + "Rendering.docx");

PdfSaveOptions saveOptions = new PdfSaveOptions();

// Create encryption details and set owner password
PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails("", "password", PdfEncryptionAlgorithm.RC_4_128);

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

// Extend permissions to allow editing or modifying annotations
encryptionDetails.setPermissions(PdfPermissions.MODIFY_ANNOTATIONS | PdfPermissions.DOCUMENT_ASSEMBLY);
saveOptions.setEncryptionDetails(encryptionDetails);

// Render the document to PDF format with the specified permissions
doc.save(getArtifactsDir() + "Rendering.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.