ImageSaveOptions Constructor

Initializes a new instance of this class that can be used to save rendered images in the Tiff, Png, Bmp, Emf, Jpeg or Svg format. Png, Bmp, Jpeg or Svg format.

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public ImageSaveOptions(
	SaveFormat saveFormat
)

Parameters

saveFormat
Type: Aspose.WordsSaveFormat
Can be Tiff, Png, Bmp, Emf, Jpeg or Svg. Png, Bmp, Jpeg or Svg.
Examples
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.docx");
// Save as a JPEG image file with default options
doc.Save(ArtifactsDir + "Rendering.SaveAsImage.DefaultJpgOptions.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(ArtifactsDir + "Rendering.SaveAsImage.CustomJpgOptions.jpg", imageOptions);
See Also