Skip to main content

LoadOptions Class

Options used to load a PDF document.

Declaration

public class LoadOptions extends JavaObject

Remarks

The following code snippet loads a document with custom load options:

import com.devexpress.docs.pdf.*;

import java.nio.channels.*;
import java.nio.file.*;

try (FileChannel channel = FileChannel.open(Path.of("document.pdf"))) {

    LoadOptions options = new LoadOptions();
    options.setPassword("password");
    options.setDetachStreamAfterLoadComplete(true);
    options.setSyncMetadata(true);
    options.setMetadataSyncMode(MetadataSyncMode.AUTO);

    try (PdfDocument pdfDocument = new PdfDocument(channel, options)) {

        // Process the document.
    }
}

The following code snippet appends a PDF document from a channel using custom load options:

// Configure load options for the appended document.
LoadOptions options = new LoadOptions();
options.setMetadataSyncMode(MetadataSyncMode.AUTO);
options.setSyncMetadata(true);
options.setPassword("USER_PASSWORD");

// Append a PDF document from a channel with custom load options.
try (ReadableByteChannel channel =
         FileChannel.open(Path.of("source.pdf"))) {

    pdfDocument.appendDocument(channel, options);
}

Refer to the following help topic for additional information: Load PDF Documents.

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
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
com.devexpress.system.JavaObject
LoadOptions

LoadOptions()

Initializes a new instance of the LoadOptions class.

Declaration

public LoadOptions()

Methods

getDetachStreamAfterLoadComplete() Method

Returns whether the source stream is detached after the load operation completes.

Declaration

public boolean getDetachStreamAfterLoadComplete()

Returns

Type Description
boolean

true if the source stream is detached after the load operation completes; otherwise, false.

getMetadataSyncMode() Method

Returns the metadata synchronization mode.

Declaration

public MetadataSyncMode getMetadataSyncMode()

Returns

Type Description
MetadataSyncMode

The metadata synchronization mode.

getPassword() Method

Returns the password used to open a password-protected document.

Declaration

public String getPassword()

Returns

Type Description
String

The password used to open a password-protected document.

getSyncMetadata() Method

Returns whether document metadata is synchronized on load.

Declaration

public boolean getSyncMetadata()

Returns

Type Description
boolean

true if document metadata is synchronized on load; otherwise, false.

setDetachStreamAfterLoadComplete(boolean value) Method

Sets whether the source stream is detached after the load operation completes.

Declaration

public void setDetachStreamAfterLoadComplete(boolean value)

Parameters

Name Type Description
value boolean

true to detach the source stream after the load operation completes; otherwise, false.

Remarks

The PDF Document API reads data from the input stream as needed and expects the stream to remain open and unchanged while the document is in use. Call the setDetachStreamAfterLoadComplete method and pass true to force the PDF Document API to read the entire document during loading and detach it from the input stream.

setMetadataSyncMode(MetadataSyncMode value) Method

Sets the metadata synchronization mode when metadata synchronization is enabled..

Declaration

public void setMetadataSyncMode(MetadataSyncMode value)

Parameters

Name Type Description
value MetadataSyncMode

The metadata synchronization mode.

setPassword(String value) Method

Sets the password used to open a password-protected document.

Declaration

public void setPassword(String value)

Parameters

Name Type Description
value String

The password used to open a password-protected document.

setSyncMetadata(boolean value) Method

Sets whether to synchronize basic document information with XMP metadata when the document is loaded.

Declaration

public void setSyncMetadata(boolean value)

Parameters

Name Type Description
value boolean

true to synchronize basic document information with XMP metadata on load; otherwise, false.