wpf-11216-controls-and-libraries-rich-text-editor-examples-export-how-to-save-a-document-as-a-series-of-images.md
This example shows how to use the DXPrinting library to save a document as a series of images. The API from the table below allows you to accomplish this task.
| Member | Description |
|---|---|
| PrintableComponentLinkBase | Initializes a new instance of the PrintableComponentLinkBase class with the default settings. |
| PrintableComponentLinkBase.Component | Gets or sets a IPrintable user implementation printed via the current link. |
| PrintableComponentLinkBase.CreateDocument | Creates a report using the current PrintingSystem. |
| ImageExportOptions | Initializes a new instance of the ImageExportOptions class with the default settings. |
| ImageExportOptions.ExportMode | Specifies whether document pages are exported to a single or multiple images. |
| ImageExportOptions.Format | Specifies the image format for exporting a document. |
| ImageExportOptions.Resolution | Specifies the image resolution (in DPI). |
| ImageExportOptions.PageRange | Specifies the range of pages to be exported. |
| PrintingSystemBase.ExportToImage | Exports a document to the specified stream as an image. Use options to specify an image format. |
The following code snippet exports the document to a series of PNG images with the specified options.
using DevExpress.XtraPrinting;
using DevExpress.XtraPrintingLinks;
using DevExpress.XtraRichEdit;
PrintableComponentLinkBase pcl = new PrintableComponentLinkBase(new PrintingSystemBase());
pcl.Component = ((IRichEditControl)richEditControl1).InnerControl;
pcl.CreateDocument(false);
ImageExportOptions imgOptions = new ImageExportOptions();
imgOptions.ExportMode = ImageExportMode.DifferentFiles;
imgOptions.Format = DXImageFormat.Png;
imgOptions.Resolution = 150;
imgOptions.PageRange = "1,3-5";
pcl.ExportToImage("export.png", imgOptions);
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraPrintingLinks
Imports DevExpress.XtraRichEdit
Dim pcl As New PrintableComponentLinkBase(New PrintingSystemBase())
pcl.Component = (CType(richEditControl1, IRichEditControl)).InnerControl
pcl.CreateDocument(False)
Dim imgOptions As New ImageExportOptions()
imgOptions.ExportMode = ImageExportMode.DifferentFiles
imgOptions.Format = DXImageFormat.Png
imgOptions.Resolution = 150
imgOptions.PageRange = "1,3-5"
pcl.ExportToImage("export.png", imgOptions)