public class PdfEncryptionAlgorithm
Example:
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 int | RC_4_40 | |
RC4 encryption, key length of 40 bits.
|
||
static final int | RC_4_128 | |
RC4 encryption, key length of 128 bits.
|