Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Use the Word Processing Document API to Export a Document to a Series of Images

You can use the RichEditDocumentServerExtensions.ExportToImage method to export document pages to images. You can export pages as a list of stream objects or to a file path. Use the RichEditDocumentServer.Document notation to access the ExportToImage method.

Important

The RichEditDocumentServerExtensions class is defined in the DevExpress.Docs.v24.2.dll assembly. Add this assembly to your project to use the RichEditDocumentServerExtensions members. You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use this library in production code.

The RichEditImageExportOptions class properties allow you to specify image export settings: image format, export mode, resolution, and so on. Pass this object as the ExportToImage method parameter to apply export settings.

The following code snippet exports the first document page to an image with the specified edge length and JPEG format:

using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.Export.Image;
using DevExpress.Drawing;


using (var wordProcessor = new RichEditDocumentServer()) {
    wordProcessor.LoadDocument(@"C:\Documents\Alice.docx");

    RichEditImageExportOptions options = new RichEditImageExportOptions();
    options.Format = DXImageFormat.Jpeg;
    options.PageRange = "1";
    options.LargestEdgeLength = 1080;

    wordProcessor.Document.ExportToImage(@"C:\Documents\Image.jpeg", options);
}