Convert to Image

This demo uses the DevExpress Word Processing Document API to export document pages to images (BMP, PNG, JPEG, EMF, SVG and more). You can process the sample file or supply your own document. To do the latter, select Upload a File in the file selection drop-down menu.

In the Image Export Settings panel, specify required image settings and select pages to export. Use the Convert to... dropdown button to select the output format, convert document pages, and download image files.

Sample document
Sample.docx



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

IReadOnlyList<Stream> ConvertToImages(Stream inputStream, DXImageFormat imageFormat, int resolution, string pageRange) {
    using var wordProcessor = new RichEditDocumentServer();

    wordProcessor.LoadDocument(inputStream);

    var imageExportOptions = new RichEditImageExportOptions {
        ExportMode = RichEditImageExportMode.DifferentFiles,
        Resolution = resolution,
        PageRange = pageRange,
        Format = imageFormat
    };

    var imageStreams = wordProcessor.Document.ExportToImage(imageExportOptions);
    return imageStreams;
}