RichEditDocumentServerExtensions.ExportToImage(Document) Method
Exports each document page to a separate image in PNG format.
Namespace: DevExpress.XtraRichEdit
Assembly: DevExpress.Docs.v24.2.dll
NuGet Package: DevExpress.Document.Processor
Declaration
Parameters
Name | Type | Description |
---|---|---|
document | Document | The document currently loaded in the |
Returns
Type | Description |
---|---|
IReadOnlyList<Stream> | A list of stream objects. Each object contains a document page converted to a PNG image format. |
Remarks
Example
The following code sample exports all document pages to images:
using DevExpress.XtraRichEdit.Export.Image;
using DevExpress.XtraRichEdit;
using DevExpress.Drawing;
using RichEditDocumentServer wordProcessor = new RichEditDocumentServer();
var streamList = wordProcessor.Document.ExportToImage();
int i = 1;
foreach (var stream in streamList) {
var newFileName = Path.GetFileNameWithoutExtension("ExportedPage.jpeg") + i + Path.GetExtension("ExportedPage.jpeg");
StreamToFile(stream, newFileName);
i++;
stream.Dispose();
}
static void StreamToFile(Stream stream, string filePath)
{
using (var fileStream = File.Create(filePath))
{
stream.Seek(0, SeekOrigin.Begin);
stream.CopyTo(fileStream);
}
}
See Also