Skip to main content

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

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
SaveOptions

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

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

getUpdateCreatedAt() Method

Returns whether the document’s creation date is updated on save.

Declaration

public boolean getUpdateCreatedAt()

Returns

Type Description
boolean

true if the document’s creation date is updated on save; otherwise, false.

getUpdateModifiedAt() Method

Returns whether the document’s modification date is updated on save.

Declaration

public boolean getUpdateModifiedAt()

Returns

Type Description
boolean

true if the document’s modification date is updated on save; otherwise, false.

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

true to synchronize document metadata on save; otherwise, false.

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

true to update the document’s creation date on save; otherwise, false.

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

true to update the document’s modification date on save; otherwise, false.