Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Words for Java allows users to export multi-page documents to raster images. This can be useful for generating previews, archives, or visual representations of documents for non-editable use.
Aspose.Words supports multi-page export to the following raster image formats:
The feature of exporting a multi-page document to an image is implemented using the MultiPageLayout class – you can specify how the pages should be organized when saving to an image:
The following code example shows how to save a multi-page DOCX document as JPEG image with Horizontal layout:
Document doc = new Document("Rendering.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
// Set up Horizontal layout.
options.setPageLayout = MultiPageLayout.Horizontal(10);
doc.save("ImageSaveOptions.HorizontalLayout.jpg", options);
You can also customize the output file page appearance – specify BackColor, BorderColor, and BorderWidth.
The following code example shows how to save a multi-page DOCX document as PNG image with Grid layout:
Document doc = new Document("Rendering.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.PNG);
// Set up a grid layout with:
// - 3 columns per row.
// - 10pts spacing between pages (horizontal and vertical).
options.setPageLayout(MultiPageLayout.grid(3, 10f, 10f));
// Customize the background and border.
options.getPageLayout().setBackColor(Color.lightGray);
options.getPageLayout().setBorderColor(Color.BLUE);
options.getPageLayout().setBorderWidth(2f);
doc.save("ImageSaveOptions.GridLayout.png", options);
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.