Skip to main content

DocumentModificationPermissions Enum

Lists values that specify permission levels for document modification operations.

Declaration

public enum DocumentModificationPermissions extends Enum<DocumentModificationPermissions> implements IIntEnum

Members

Name Description
ALLOWED

Allows document modification and assembly operations.

DOCUMENT_ASSEMBLING

Allows document assembly operations only, including inserting, rotating, or deleting pages and creating bookmarks in the navigation pane.

NOT_ALLOWED

Prohibits document modification and assembly operations.

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.setModificationPermissions() 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.

Implements

com.devexpress.java.enums.IIntEnum

Inherited Members

java.lang.Enum.<T>valueOf(java.lang.Class<T>,java.lang.String)
java.lang.Enum.clone()
java.lang.Enum.compareTo(E)
java.lang.Enum.describeConstable()
java.lang.Enum.equals(java.lang.Object)
java.lang.Enum.finalize()
java.lang.Enum.getDeclaringClass()
java.lang.Enum.hashCode()
java.lang.Enum.name()
java.lang.Enum.ordinal()
java.lang.Enum.toString()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
java.lang.Enum
DocumentModificationPermissions