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
Inheritance
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 |
|
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 |
|
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 |
|
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 |
|