ImageExportOptions Class
Options used to export PDF pages as images.
Declaration
public class ImageExportOptions extends JavaObject
Remarks
Note
The exportToImages method returns an array of DXImage objects. Dispose of each image after use to release resources.
The following code snippet exports the first two pages to SVG images using custom image export options:
import com.devexpress.drawing.*;
import com.devexpress.docs.pdf.*;
import java.nio.channels.*;
import java.nio.file.*;
public class Main {
public static void main(String[] args) throws Exception {
try (PdfDocument pdfDocument =
new PdfDocument(FileChannel.open(Path.of("document.pdf")))) {
// Configure image export settings.
ImageExportOptions options = new ImageExportOptions();
options.setImageExportType(ImageExportType.SVG);
options.setLargestEdgeLength(1000);
// Export pages 1 and 2 to images.
DXImage[] images = pdfDocument.exportToImages(
options,
new int[] { 0, 1 });
try {
// Save each exported page as an SVG file.
for (int i = 0; i < images.length; i++) {
images[i].save("page-" + (i + 1) + ".svg");
}
} finally {
// Release image resources.
for (DXImage image : images) {
image.close();
}
}
}
}
}
Refer to the following help topic for additional information: Export PDF Pages to Images.
Inherited Members
Inheritance
ImageExportOptions()
Initializes a new instance of the ImageExportOptions class.
Declaration
public ImageExportOptions()
Methods
getImageExportType() Method
Returns the image export type.
Declaration
public ImageExportType getImageExportType()
Returns
| Type | Description |
|---|---|
| ImageExportType | The image export type. |
getLargestEdgeLength() Method
Returns the output image height for portrait orientation and width for landscape pages.
Declaration
public @Nullable Integer getLargestEdgeLength()
Returns
| Type | Description |
|---|---|
The largest edge length for exported images, in pixels. |
getResolution() Method
Returns the export resolution.
Declaration
public float getResolution()
Returns
| Type | Description |
|---|---|
| float | The export resolution, in DPI. |
setImageExportType(ImageExportType value) Method
Sets the image export type.
Declaration
public void setImageExportType(ImageExportType value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | ImageExportType | The image export type. |
setLargestEdgeLength(@Nullable Integer value) Method
Sets the output image height for portrait orientation and width for landscape pages.
Declaration
public void setLargestEdgeLength(@Nullable Integer value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | The largest edge length for exported images, in pixels. |
setResolution(float value) Method
Sets the export resolution.
Declaration
public void setResolution(float value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | float | The export resolution, in DPI. |