ImageSaveOptions Class
Contents
[
Hide
]ImageSaveOptions class
Specific options data class. It provides properties to manage image result resolution, smooting quality, format as well as page settings and etc. More info you can obtain in documentation article.
public class ImageSaveOptions : ImageRenderingOptions
Constructors
| Name | Description | 
|---|---|
| ImageSaveOptions() | Initializes a new instance of the ImageSaveOptionsclass; Png will be used as default image format. | 
| ImageSaveOptions(ImageFormat) | Image format ImageFormatbased on initialization | 
Properties
| Name | Description | 
|---|---|
| [getBackgroundColor] | |
| [setBackgroundColor] Gets or sets Color which will fill background of every page. Default value is Transparent. | |
| [getCompression] | |
| [setCompression] Sets or gets Tagged Image File Format (TIFF) Compression. By default this property is LZW. | |
| getCss Gets a CssOptionsobject which is used for configuration of css properties processing. | |
| [getFormat] | |
| [setFormat] Sets or gets ImageFormat. By default this property is Png. | |
| horizontalResolution { get; set; } | Sets or gets horizontal resolution for output and internal (which are used during filters processing) images, in pixels per inch. By default this property is 300 dpi. | 
| getPageSetup Gets a page setup object is used for configuration output page-set. | |
| getText Gets a TextOptionsobject which is used for configuration of text rendering. | |
| [getUseAntialiasing] | |
| [setUseAntialiasing] Specifies whether to use antialiasing. By default, antialiasing is enabled. | |
| verticalResolution { get; set; } | Sets or gets vertical resolution for output and internal (which are used during filters processing) images, in pixels per inch. By default this property is 300 dpi. | 
Remarks
You can download the complete examples and data files from GitHub.
Examples
import Aspose.Html;
import com.aspose.html.converters;
import com.aspose.html.drawing;
import com.aspose.html.rendering.image;
import com.aspose.html.saving;
...
      // Prepare a path to a source HTML file
      String documentPath = Path.Combine(DataDir, "nature.html");
      // Prepare a path for converted file saving 
      String savePath = Path.Combine(OutputDir, "nature-output-options.png");
      // Initialize an HTML document from the file
      using var document = new HTMLDocument(documentPath);
      // Initialize ImageSaveOptions       
      var options = new ImageSaveOptions()
      {
        SmoothingMode = SmoothingMode.Default,
        HorizontalResolution = 100,
        VerticalResolution = 100,
        BackgroundColor = Color.Beige
      };
      // Convert HTML to PNG
      Converter.ConvertHTML(document, options, savePath);
See Also
- class ImageRenderingOptions
- package com.aspose.html.saving
- package Aspose.HTML