Skip to main content

DocumentDataExtractionPermissions Enum

Lists values that specify permissions for data extraction operations.

Declaration

public enum DocumentDataExtractionPermissions extends Enum<DocumentDataExtractionPermissions> implements IIntEnum

Members

Name Description
ACCESSIBILITY

Allows PDF viewers to access document contents through accessibility features.

ALLOWED

Allows data extraction operations, including copying content and extracting text and graphics from the document. Also allows access for software that uses assistive technologies.

NOT_ALLOWED

Prohibits data extraction operations, including copying content and extracting text and graphics from the document. Also prevents access by software that uses assistive technologies.

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

Create an EncryptionOptions object, configure permissions, and pass the configured object to the PdfDocument.encrypt() method to encrypt the PDF document.

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: Set PDF Document Permissions.

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
DocumentDataExtractionPermissions