DocSaveOptions

DocSaveOptions class

Specific options data class. By assigning properties you can manage rendering characteristics such as resolution, page size, background color as well as doc specific options such as font embedding. More info see in documentation article.

public class DocSaveOptions : DocRenderingOptions

Constructors

Name Description
DocSaveOptions() The default constructor.

Properties

Name Description
BackgroundColor { get; set; } Gets or sets Color which will fill background of every page. Default value is Transparent.
Css { get; } Gets a CssOptions object which is used for configuration of css properties processing.
DocumentFormat { get; set; } Gets or sets the file format of the output document. The default value is DOCX.
FontEmbeddingRule { get; set; } Gets or sets the font embedding rule. The default value is None.
virtual HorizontalResolution { get; set; } Sets or gets horizontal resolution for internal (which are used during filters processing) images, in pixels per inch. By default this property is 300 dpi.
PageSetup { get; } Gets a page setup object is used for configuration output page-set.
virtual VerticalResolution { get; set; } Sets or gets vertical resolution for 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

using Aspose.Html;
using Aspose.Html.Converters;
using Aspose.Html.Drawing;
using Aspose.Html.Saving;
using System;
...
 // Prepare a path to a source HTML file
      string documentPath = Path.Combine(DataDir, "canvas.html");

      // Prepare a path for converted file saving 
      string savePath = Path.Combine(OutputDir, "canvas-output-options.docx");

      // Initialize an HTML document from the file
      using var document = new HTMLDocument(documentPath);

      // Initialize DocSaveOptions. Set up the page-size 600x400 pixels and margins
      var options = new DocSaveOptions();
      options.PageSetup.AnyPage = new Page(new Aspose.Html.Drawing.Size(600, 400), new Margin(10, 10, 10, 10));

      // Convert HTML to DOCX
      Converter.ConvertHTML(document, options, savePath);

*OutputDir - custom output folder path.

See Also