public void SaveAsImage()
{
//ExStart
//ExFor:ImageSaveOptions.#ctor
//ExFor:Document.Save(String)
//ExFor:Document.Save(Stream, SaveFormat)
//ExFor:Document.Save(String, SaveOptions)
//ExId:SaveToImage_NewAPI
//ExSummary:Shows how to save a document to the Jpeg format using the Save method and the ImageSaveOptions class.
// Open the document
Document doc = new Document(MyDir + "Rendering.doc");
// Save as a Jpeg image file with default options
doc.Save(MyDir + @"\Artifacts\Rendering.JpegDefaultOptions.jpg");
// Save document to stream as a Jpeg with default options
MemoryStream docStream = new MemoryStream();
doc.Save(docStream, SaveFormat.Jpeg);
// Rewind the stream position back to the beginning, ready for use
docStream.Seek(0, SeekOrigin.Begin);
// Save document to a Jpeg image with specified options.
// Render the third page only and set the jpeg quality to 80%
// In this case we need to pass the desired SaveFormat to the ImageSaveOptions constructor
// to signal what type of image to save as.
ImageSaveOptions imageOptions = new ImageSaveOptions(SaveFormat.Jpeg);
imageOptions.PageIndex = 2;
imageOptions.PageCount = 1;
imageOptions.JpegQuality = 80;
doc.Save(MyDir + @"\Artifacts\Rendering.JpegCustomOptions.jpg", imageOptions);
//ExEnd
}