ResizeMode Enum
Lists resize modes.
Declaration
public enum ResizeMode extends Enum<ResizeMode> implements IIntEnum
Members
| Name | Description |
|---|---|
CENTER
|
Centers content on the resized slide. |
ENSURE_FILL
|
Scales content to fill the resized slide. |
ENSURE_FIT
|
Scales content to fit within the resized slide. |
STRETCH
|
Stretches content to fill the resized slide. |
fromValue(int value)
|
Returns the enum item with the specified integer value. |
getName()
|
Returns the enum item name. |
getValue()
|
Returns the integer value. |
toString()
|
Returns the string representation. |
valueOf(String name)
|
Returns the enum constant with the specified name. |
values()
|
Returns available constants. |
Remarks
Use the Presentation.resizeSlides(newSize, mode) method to resize all slides in a presentation to the specified size. The mode parameter specifies how to resize the slide content.
The following example resizes slides to 640 × 360 and scales the content to fit within the new slide boundaries:
package presentation;
import com.devexpress.docs.presentation.*;
import java.io.FileOutputStream;
import java.nio.file.*;
public class Main {
public static void main(String[] args) throws Exception {
try(Presentation presentation =
new Presentation(Files.readAllBytes(Path.of("Presentation.pptx")))) {
presentation.resizeSlides(new SlideSize(640, 360), ResizeMode.ENSURE_FIT);
Path outputDir = Path.of("output");
Files.createDirectories(outputDir);
try (FileOutputStream fileStream = new FileOutputStream(
outputDir.resolve("PresentationResized.pptx").toFile())) {
presentation.saveDocument(fileStream);
}
}
}
}
Refer to the following help topic for additional information: Slide Size and Orientation — Presentation API for Java.