In the Aspose.Words for .NET 25.6 release, we introduced a new feature that allows you to export a multi-page document to a single raster image. This is useful when you need to share or display the document as a single visual file.

What’s New In Aspose.Words for .NET 25.6

Before version 25.6, saving a multi-page document to an image format (such as PNG or JPEG) created a single image for only the first page of the document. Now, you can combine all document pages into a single image, or even save a multi-page document as a multi-page TIFF using the new MultiPageLayout class.

Image

How to Convert a Multi-page Document to an Image

First of all, you should know that multi-page export works for the following raster image formats: Jpeg, Gif, Png, Bmp, Tiff, WebP.

In addition to the output file format, you need to choose how the page layout will look after converting a multi-page document to an image. You can choose from the following options:

  • SinglePage – save only the first of the specified pages
  • Grid – arrange the pages in a grid, left to right and top to bottom, specifying the columns’ number
  • Horizontal – arrange the pages horizontally next to each other from left to right in a single output
  • Vertical – arrange the pages vertically one below the other in a single output
  • TiffFrames – arrange each page as a separate frame in a multi-frame TIFF image

Then, 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.PageLayout = MultiPageLayout.Grid(3, 10, 10);

// Customize the background and border.
options.PageLayout.BackColor = Color.LightGray;
options.PageLayout.BorderColor = Color.Blue;
options.PageLayout.BorderWidth = 2;

doc.Save("ImageSaveOptions.GridLayout.png", options);

Summary

The new multi-page export feature in Aspose.Words for .NET 25.6 makes it easy to create a single image from a multi-page document. This is ideal for previews, printing, or sharing documents as visuals. You have full control over how pages are arranged in the final image.

To try this feature, download the latest version of Aspose.Words for .NET.