How to: Save a Document as a Series of Images
- 2 minutes to read
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 |
---|---|
Printable |
Initializes a new instance of the Printable |
Printable |
Gets or sets a IPrintable user implementation printed via the current link. |
Printable |
Creates a report using the current Printing |
Image |
Initializes a new instance of the Image |
Image |
Specifies whether document pages are exported to a single or multiple images. |
Image |
Specifies the image format for exporting a document. |
Image |
Specifies the image resolution (in DPI). |
Image |
Specifies the range of pages to be exported. |
Printing |
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);