DocumentInteractivityPermissions Enum
Lists values that specify permissions for document interaction operations.
Declaration
public enum DocumentInteractivityPermissions extends Enum<DocumentInteractivityPermissions> implements IIntEnum
Members
| Name | Description |
|---|---|
ALLOWED
|
Allows interactive operations in the PDF document, including adding or modifying text annotations, filling in interactive form fields, and creating or modifying interactive form fields. |
FORM_FILL_AND_SIGN
|
Allows filling in existing form fields and applying signatures only. |
NOT_ALLOWED
|
Prohibits interactive operations in the PDF document, including adding or modifying text annotations, filling in interactive form fields, and creating or modifying interactive form fields. |
fromValue(int value)
|
Returns the enum item with the specified integer value. |
getName()
|
Returns the enum item name. |
getValue()
|
Returns the integer value. |
toString()
|
Returns the string representation. |
valueOf(String name)
|
Returns the enum constant with the specified name. |
values()
|
Returns available constants. |
Remarks
Use the EncryptionOptions.setInteractivityPermissions() method to define document modification permissions.
The following code snippet loads a PDF document, encrypts it, restricts specific operations, and saves the result:
import com.devexpress.docs.pdf.*;
import java.nio.file.*;
import java.nio.channels.*;
public class Main {
public static void main(String[] args) throws Exception {
try (FileChannel channel = FileChannel.open(Path.of("Document.pdf"));
PdfDocument pdfDocument = new PdfDocument(channel)) {
EncryptionOptions encryptionOptions = new EncryptionOptions(
"ownerPassword",
"userPassword"
) {{
setDataExtractionPermissions(DocumentDataExtractionPermissions.NOT_ALLOWED);
setPrintPermissions(DocumentPrintPermissions.LOW_QUALITY);
setModificationPermissions(DocumentModificationPermissions.NOT_ALLOWED);
setAlgorithm(EncryptionAlgorithm.AES_256);
}};
pdfDocument.encrypt(encryptionOptions);
// Save the encrypted document.
try (WritableByteChannel writableByteChannel =
FileChannel.open(Path.of("Document_encrypted.pdf"),
StandardOpenOption.CREATE,
StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING)) {
pdfDocument.save(writableByteChannel);
}
}
}
}
Refer to the following help topic for additional information: Encrypt PDF Documents.