SaveOptions Class
Options used to save a PDF document.
Declaration
public class SaveOptions extends JavaObject
Remarks
The following code snippet loads a PDF document, adds a page, and saves the document using a writable channel:
import com.devexpress.docs.pdf.*;
import com.devexpress.drawing.printing.*;
import java.nio.channels.*;
import java.nio.file.*;
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)) {
// Add an A4-size page to the document.
pdfDocument.getPages().add(DXPaperKind.A4);
// Configure save options.
SaveOptions saveOptions = new SaveOptions();
saveOptions.setUpdateCreatedAt(true);
saveOptions.setSyncMetadata(true);
// Save the document to a PDF file.
try (WritableByteChannel writableByteChannel =
FileChannel.open(Path.of("Document.pdf"),
StandardOpenOption.CREATE,
StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING)) {
pdfDocument.save(writableByteChannel, saveOptions);
}
}
}
}
Refer to the following help topic for additional information: Save PDF Documents.
Inherited Members
Inheritance
SaveOptions()
Initializes a new instance of the SaveOptions class.
Declaration
public SaveOptions()
Methods
getMetadataSyncMode() Method
Returns the metadata synchronization mode.
Declaration
public MetadataSyncMode getMetadataSyncMode()
Returns
| Type | Description |
|---|---|
| MetadataSyncMode | The metadata synchronization mode. |
getSyncMetadata() Method
Returns whether document metadata is synchronized on save.
Declaration
public boolean getSyncMetadata()
Returns
| Type | Description |
|---|---|
| boolean |
|
getUpdateCreatedAt() Method
Returns whether the document’s creation date is updated on save.
Declaration
public boolean getUpdateCreatedAt()
Returns
| Type | Description |
|---|---|
| boolean |
|
getUpdateModifiedAt() Method
Returns whether the document’s modification date is updated on save.
Declaration
public boolean getUpdateModifiedAt()
Returns
| Type | Description |
|---|---|
| boolean |
|
setMetadataSyncMode(MetadataSyncMode value) Method
Sets the metadata synchronization mode.
Declaration
public void setMetadataSyncMode(MetadataSyncMode value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | MetadataSyncMode | The metadata synchronization mode. |
setSyncMetadata(boolean value) Method
Sets whether document metadata is synchronized on save.
Declaration
public void setSyncMetadata(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
setUpdateCreatedAt(boolean value) Method
Sets whether the document’s creation date is updated on save.
Declaration
public void setUpdateCreatedAt(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
setUpdateModifiedAt(boolean value) Method
Sets whether the document’s modification date is updated on save.
Declaration
public void setUpdateModifiedAt(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|