XpsSaveOptions Class
Contents
[
Hide
]XpsSaveOptions class
Specific options data class provides few properties to manage conversion result. For example PageSetup
specifies page characteristics. Refer to documentation article.
public class XpsSaveOptions : XpsRenderingOptions
Constructors
Name | Description |
---|---|
XpsSaveOptions() | 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. |
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 find complete examples and data files on GitHub.
Examples
using Aspose.Html;
using Aspose.Html.Converters;
using Aspose.Html.Saving;
using System;
...
string documentPath = Path.Combine(OutputDir, "save-options.html");
string savePath = Path.Combine(OutputDir, "save-options-output.xps");
// Prepare HTML code and save it to a file
var code = "<h1> XpsSaveOptions Class</h1>\r\n" +
"<p>Using XpsSaveOptions Class, you can programmatically apply a wide range of conversion parameters such as BackgroundColor, PageSetup, etc.</p>\r\n";
File.WriteAllText(documentPath, code);
// Initialize an HTML Document from the html file
using var document = new HTMLDocument(documentPath);
// Set up the page-size, margins and change the background color to AntiqueWhite
var options = new XpsSaveOptions()
{
BackgroundColor = Color.AntiqueWhite
};
options.PageSetup.AnyPage = new Page(new Aspose.Html.Drawing.Size(Length.FromInches(4.9f), Length.FromInches(3.5f)), new Margin(30, 20, 10, 10));
// Convert HTML to XPS
Converter.ConvertHTML(document, options, savePath);
See Also
- class XpsRenderingOptions
- namespace Aspose.Html.Saving
- assembly Aspose.HTML