### Install Prerelease Aspose.HTML via NuGet Package Manager Console Source: https://docs.aspose.com/html/net/getting-started/installation Append '-prerelease' to install the latest full release including hot fixes. ```powershell Install-Package Aspose.HTML -prerelease ``` -------------------------------- ### Install Aspose.HTML for .NET Package Source: https://docs.aspose.com/html/net/how-to-add-alt-text-to-images Use this NuGet command to install the Aspose.HTML library for your .NET project. ```powershell 1Install-Package Aspose.HTML ``` -------------------------------- ### Setup Markdown Syntax Tree Source: https://docs.aspose.com/html/net/create-markdown-documents Initializes the Markdown syntax tree and syntax factory. This is a prerequisite for most Markdown operations. ```csharp var md = new MarkdownSyntaxTree(new Configuration()); var factory = md.SyntaxFactory; ``` -------------------------------- ### Install Aspose.HTML via NuGet Package Manager Console Source: https://docs.aspose.com/html/net/getting-started/installation Use this command in the Package Manager Console to install the latest version of Aspose.HTML for .NET. ```powershell Install-Package Aspose.HTML ``` -------------------------------- ### HTML Example for Type Selector Source: https://docs.aspose.com/html/net/tutorial/css-selectors Demonstrates HTML content that would be affected by the CSS Type Selector. ```html 1

Aspose.HTML for .NET

2

Aspose.HTML for .NET is a cross-platform class library that enables your applications to perform a wide range of HTML manipulation tasks.

``` -------------------------------- ### Initialize WebAccessibility and Get Rules Source: https://docs.aspose.com/html/net/web-accessibility-rules Initialize a WebAccessibility container to access the AccessibilityRules repository. This repository holds WCAG 2.0 requirements, success criteria, and techniques. ```csharp var webAccessibility = new WebAccessibility(); AccessibilityRules accessibilityRules = webAccessibility.Rules; ``` -------------------------------- ### Convert HTML to BMP Source: https://docs.aspose.com/html/net/convert-html-to-bmp This example demonstrates a direct conversion of an HTML file to a BMP image file using Aspose.HTML for .NET. Ensure the 'document.html' file exists in the project directory. ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var document = new HTMLDocument("document.html"); var options = new ImageSaveOptions(ImageFormat.Bmp); Converter.ConvertHTML(document, options, "output.bmp"); ``` -------------------------------- ### Convert HTML to MHTML with Default Options Source: https://docs.aspose.com/html/net/convert-html-to-mhtml This example demonstrates converting an HTML document to MHTML using default save options. Load an HTML file and then convert it to MHTML. ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var document = new HTMLDocument("{{input lower}}"); {{#if_output 'PDF'}} var options = new PdfSaveOptions(); {{/if_output}} {{#if_output 'MHTML'}} var options = new MHTMLSaveOptions(); {{/if_output}} {{#if_output 'DOCX'}} var options = new DocSaveOptions(); {{/if_output}} {{#if_output 'XPS'}} var options = new XpsSaveOptions(); {{/if_output}} {{#if_output 'MD'}} var options = new MarkdownSaveOptions(); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF'}} var options = new ImageSaveOptions(ImageFormat.{{output param2 camel}}); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF' 'PDF' 'MHTML' 'MD' 'XPS' 'DOCX'}} Converter.ConvertHTML(document, options, "output.{{output lower}}"); {{/if_output}} {{#if_output 'XHTML'}} document.Save("output.xhtml", new HTMLSaveOptions() { DocumentType = HTMLSaveOptions.XHTML }); {{/if_output}} ``` -------------------------------- ### Convert HTML to DOCX with Custom Page Setup Source: https://docs.aspose.com/html/net/convert-html-to-docx Use DocSaveOptions to specify custom page setup, such as page size, when converting HTML to DOCX. This example sets the page size to A5. ```csharp string documentPath = Path.Combine(OutputDir, "save-options.html"); string savePath = Path.Combine(OutputDir, "save-options-output.docx"); // Prepare HTML code and save it to a file string code = "

DocSaveOptions Class

\r\n" + "

Using DocSaveOptions Class, you can programmatically apply a wide range of conversion parameters.

\r\n"; File.WriteAllText(documentPath, code); // Initialize an HTML Document from the html file using HTMLDocument document = new HTMLDocument(documentPath); // Initialize DocSaveOptions. Set A5 as a page-size DocSaveOptions options = new DocSaveOptions(); options.PageSetup.AnyPage = new Page(new Aspose.Html.Drawing.Size(Length.FromInches(8.3f), Length.FromInches(5.8f))); // Convert HTML to DOCX Converter.ConvertHTML(document, options, savePath); ``` -------------------------------- ### Install System Fonts and Font Tools in Docker Source: https://docs.aspose.com/html/net/html-to-image-linux-docker-fonts Installs essential system fonts, font configuration utilities, and development libraries required for text rendering and image processing within a .NET runtime Docker image. This setup ensures Aspose.HTML can locate and use fonts from the default `/usr/share/fonts` directory. ```dockerfile FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base RUN apt-get update && apt-get install -y --no-install-recommends \ libc6-dev \ libgdiplus \ fontconfig \ fonts-dejavu-core \ fonts-dejavu-extra \ fonts-liberation \ fonts-freefont-ttf \ locales \ ca-certificates \ && rm -rf /var/lib/apt/lists/* ``` -------------------------------- ### Convert HTML to Various Formats with Options Source: https://docs.aspose.com/html/net/convert-html-to-xps This example demonstrates how to convert an HTML document to different formats (PDF, MHTML, DOCX, XPS, MD, Images, XHTML) by selecting appropriate save options. It requires importing namespaces like Aspose.Html, Aspose.Html.Converters, and Aspose.Html.Saving. ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var document = new HTMLDocument("{{input lower}}"); {{#if_output 'PDF'}} var options = new PdfSaveOptions(); {{/if_output}} {{#if_output 'MHTML'}} var options = new MHTMLSaveOptions(); {{/if_output}} {{#if_output 'DOCX'}} var options = new DocSaveOptions(); {{/if_output}} {{#if_output 'XPS'}} var options = new XpsSaveOptions(); {{/if_output}} {{#if_output 'MD'}} var options = new MarkdownSaveOptions(); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF'}} var options = new ImageSaveOptions(ImageFormat.{{output param2 camel}}); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF' 'PDF' 'MHTML' 'MD' 'XPS' 'DOCX'}} Converter.ConvertHTML(document, options, "output.{{output lower}}"); {{/if_output}} {{#if_output 'XHTML'}} document.Save("output.xhtml", new HTMLSaveOptions() { DocumentType = HTMLSaveOptions.XHTML }); {{/if_output}} ``` -------------------------------- ### Implement Custom Message Handler Behavior Source: https://docs.aspose.com/html/net/message-handlers/custom-message-handler Override the Invoke method to implement custom logic. This example logs the request URI when processing starts and finishes, and then calls the next handler in the chain. ```csharp // Implement a message handler that prints a message about starting and finishing processing request public class LogMessageHandler : MessageHandler { // Override the Invoke() method public override void Invoke(INetworkOperationContext context) { Debug.WriteLine("Start processing request: " + context.Request.RequestUri); // Invoke the next message handler in the chain Next(context); Debug.WriteLine("Finish processing request: " + context.Request.RequestUri); } } ``` -------------------------------- ### JSON Data Source Example Source: https://docs.aspose.com/html/net/html-template This is an example of a JSON data source structure. ```json 1{ 2 "FirstName": "John", 3 "LastName": "Doe", 4 "Address": { 5 "City": "Dallas", 6 "Street": "Austin rd.", 7 "Number": "200" 8 } 9 } ``` -------------------------------- ### Apply License from File Name Source: https://docs.aspose.com/html/net/getting-started/licensing Apply the license by specifying the license file name. Ensure the license file is in the same folder as Aspose.HTML.dll. ```csharp 1 // Initialize a license object 2 Aspose.Html.License htmlLicense = new Aspose.Html.License(); 3 4 // Apply the license using the file name 5 htmlLicense.SetLicense("Aspose.HTML.lic"); ``` -------------------------------- ### XML Data Source Example Source: https://docs.aspose.com/html/net/html-template This is an example of an XML data source structure. ```xml 1 2 John\ 3 Doe\ 4
\ 5 Dallas\ 6 Austin rd.\ 7 200\ 8
9
``` -------------------------------- ### Convert EPUB to PNG Step-by-Step Source: https://docs.aspose.com/html/net/convert-epub-to-png This snippet shows the detailed process: opening the EPUB file, setting save options, and then converting. It requires explicit file stream handling and option instantiation. ```csharp // Convert EPUB to PNG in C# // Open an existing EPUB file for reading using FileStream stream = File.OpenRead(DataDir + "input.epub"); // Prepare a path to save the converted file string savePath = Path.Combine(OutputDir, "input-output.png"); // Create an instance of the ImageSaveOptions class ImageSaveOptions options = new ImageSaveOptions(); // Call the ConvertEPUB() method to convert EPUB to PNG Converter.ConvertEPUB(stream, options, savePath); ``` -------------------------------- ### Convert EPUB to various formats with options Source: https://docs.aspose.com/html/net/convert-epub-to-xps This example demonstrates how to convert an EPUB file to different output formats, including XPS, PDF, DOCX, and images, by dynamically setting save options. It requires specifying the correct save options class based on the desired output format. ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var stream = File.OpenRead(DataDir + "input.epub"); {{#if_output 'PDF'}} var options = new PdfSaveOptions(); {{/if_output}} {{#if_output 'DOCX'}} var options = new DocSaveOptions(); {{/if_output}} {{#if_output 'XPS'}} var options = new XpsSaveOptions(); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF'}} var options = new ImageSaveOptions(ImageFormat.{{output param2 camel}}); {{/if_output}} Converter.ConvertEPUB(stream, options, "output.{{output lower}}"); ``` -------------------------------- ### Apply License using Singleton Pattern Source: https://docs.aspose.com/html/net/getting-started/licensing Implement license application using lazy initialization with a Singleton pattern for efficient and centralized license management. ```csharp 1 internal class LicenseSingleton 2 { 3 private static LicenseSingleton _instance = new LicenseSingleton(); 4 private LicenseSingleton() 5 { 6 // init the license 7 (new Aspose.Html.License()).SetLicense(@"F:\\aspose.html.net\\testdata\\license\\Aspose.HTML.NET.lic"); 8 } 9 10 public static void SetLicense() 11 { 12 LicenseSingleton local = _instance; 13 } 14 } 15 16 static void Main(string[] args) 17 { 18 //lazy initialization before using the library 19 LicenseSingleton.SetLicense(); 20 } ``` -------------------------------- ### Start Request Duration Logging Message Handler Source: https://docs.aspose.com/html/net/message-handlers/time-logging Concrete implementation of a message handler that starts a stopwatch for a given request URL. It overrides the Invoke method to call StartTimer and then proceeds to the next handler in the chain. ```csharp 21class StartRequestDurationLoggingMessageHandler : RequestDurationLoggingMessageHandler 22{ 23 // Override the Invoke() method 24 public override void Invoke(INetworkOperationContext context) 25 { 26 // Start the stopwatch 27 StartTimer(context.Request.RequestUri); 28 29 // Invoke the next message handler in the chain 30 Next(context); 31 } 32} ``` -------------------------------- ### Programmatic Markdown to XPS Conversion in C# Source: https://docs.aspose.com/html/net/convert-markdown-to-xps This example demonstrates a direct programmatic conversion of a Markdown file to an XPS file using Aspose.HTML for .NET. It specifies XPS output options explicitly. ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var document = Converter.ConvertMarkdown("input.md"); var options = new XpsSaveOptions(); Converter.ConvertHTML(document, options, "output.xps"); ``` -------------------------------- ### HTML Conversion Options in C# Source: https://docs.aspose.com/html/net/convert-html-to-docx This example demonstrates how to set up conversion options for various output formats, including DOCX, using Aspose.HTML for .NET. The specific save options class is chosen based on the desired output format. ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var document = new HTMLDocument("{{input lower}}"); {{#if_output 'PDF'}} var options = new PdfSaveOptions(); {{/if_output}} {{#if_output 'MHTML'}} var options = new MHTMLSaveOptions(); {{/if_output}} {{#if_output 'DOCX'}} var options = new DocSaveOptions(); {{/if_output}} {{#if_output 'XPS'}} var options = new XpsSaveOptions(); {{/if_output}} {{#if_output 'MD'}} var options = new MarkdownSaveOptions(); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF'}} var options = new ImageSaveOptions(ImageFormat.{{output param2 camel}}); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF' 'PDF' 'MHTML' 'MD' 'XPS' 'DOCX'}} Converter.ConvertHTML(document, options, "output.{{output lower}}"); {{/if_output}} {{#if_output 'XHTML'}} document.Save("output.xhtml", new HTMLSaveOptions() { DocumentType = HTMLSaveOptions.XHTML }); {{/if_output}} ``` -------------------------------- ### HTML Paragraph Example Source: https://docs.aspose.com/html/net/tutorial/css-selectors This HTML snippet demonstrates paragraphs that can be targeted by CSS selectors, including pseudo-selectors. ```html

Pseudo-Element Selectors

A CSS Pseudo-Element is used to style specified parts of an element.

For example, p::first-letter can be used to change the first letter of a paragraph.

``` -------------------------------- ### XML Data Source Example Source: https://docs.aspose.com/html/net/html-template This XML structure serves as a data source for populating an HTML template. ```xml John Doe
Dallas Austin rd. 200
``` -------------------------------- ### Convert MHTML to various formats Source: https://docs.aspose.com/html/net/mhtml-converter This example illustrates a flexible approach to converting MHTML files to different formats (PDF, DOCX, XPS, BMP, JPG, GIF, PNG, TIFF) by dynamically setting save options based on the desired output format. It uses a placeholder for the output format and demonstrates how to instantiate the appropriate save options class. ```APIDOC ## Convert MHTML to Various Formats ### Description This snippet shows a generalized method for converting MHTML to different formats like PDF, DOCX, XPS, or various image types. The `options` variable is dynamically set based on the desired output format, allowing for flexible conversions. ### Method `Converter.ConvertMHTML(Stream, SaveOptions, string)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var stream = File.OpenRead("sample.mht"); {{#if_output 'PDF'}} var options = new PdfSaveOptions(); {{/if_output}} {{#if_output 'DOCX'}} var options = new DocSaveOptions(); {{/if_output}} {{#if_output 'XPS'}} var options = new XpsSaveOptions(); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF'}} var options = new ImageSaveOptions(ImageFormat.{{output param2 camel}}); {{/if_output}} Converter.ConvertMHTML(stream, options, "output.{{output lower}}"); ``` ### Response #### Success Response (200) Conversion is successful, and the output file is generated in the specified format. #### Response Example ```csharp // Example for PDF conversion using var stream = File.OpenRead("sample.mht"); var options = new PdfSaveOptions(); Converter.ConvertMHTML(stream, options, "output.pdf"); ``` ``` -------------------------------- ### HTML Example for Universal Selector Source: https://docs.aspose.com/html/net/tutorial/css-selectors Provides HTML content to demonstrate the effect of the CSS Universal Selector on all elements. ```html 1

CSS Universal Selector

2

The Universal Selector selects all elements. The star symbol will target every single element on the page.

``` -------------------------------- ### Apply License from Stream Source: https://docs.aspose.com/html/net/getting-started/licensing Apply the license by providing a file stream. This is useful when the license file is not directly accessible by name. ```csharp 1 // Initialize a license object 2 Aspose.Html.License htmlLicense = new Aspose.Html.License(); 3 4 // Open a license file stream 5 using (var stream = new System.IO.FileStream("Aspose.HTML.lic", System.IO.FileMode.Open)) 6 { 7 // Apply the license using the stream 8 htmlLicense.SetLicense(stream); 9 } ``` -------------------------------- ### Apply Metered License with Public and Private Keys Source: https://docs.aspose.com/html/net/getting-started/licensing Initialize the Metered object and apply the metered license using your public and private keys. This should typically be done once on application start. Ensure a stable internet connection for this mechanism to function correctly. ```csharp Aspose.Html.Metered metered = new Aspose.Html.Metered(); metered.SetMeteredKey("*****", "*****"); ``` -------------------------------- ### HTML Example for ID Selector Source: https://docs.aspose.com/html/net/tutorial/css-selectors Shows an HTML paragraph with an 'id' attribute that can be targeted by the CSS ID Selector. ```html 1

This paragraph has a special ID on it!

2

This is just a regular paragraph.

``` -------------------------------- ### Configure .NET Project for Docker with Aspose.HTML Source: https://docs.aspose.com/html/net/how-to-run-aspose-html-in-docker This .NET project file configures the application for .NET 6, includes necessary Aspose.HTML and Docker-related NuGet packages, and sets InvariantGlobalization to false for compatibility within Linux Docker environments. It also ensures 'document.html' is copied to the output directory. ```xml Exe net6.0 enable enable Linux Always false ``` -------------------------------- ### Convert HTML to PDF in C# Source: https://docs.aspose.com/html/net/html-converter This example shows a basic conversion of an HTML file to a PDF document using default save options. Ensure the 'document.html' file exists in the same directory or provide a full path. ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var document = new HTMLDocument("document.html"); var options = new PdfSaveOptions(); Converter.ConvertHTML(document, options, "output.pdf"); ``` -------------------------------- ### HTML Example for Class Selector Source: https://docs.aspose.com/html/net/tutorial/css-selectors Illustrates HTML elements, one of which has a 'class' attribute that can be targeted by the CSS Class Selector. ```html 1

CSS Class Selector

2

The class attribute and its value can be used to create a CSS selector that refers to the selected web element.

3

The dot (.) is used to indicate the class attribute to create the CSS Class selector.

``` -------------------------------- ### Update Aspose.HTML via NuGet Package Manager Console Source: https://docs.aspose.com/html/net/getting-started/installation Use this command to check for and install updates for the Aspose.HTML for .NET package. ```powershell Update-Package Aspose.HTML ``` -------------------------------- ### C# Example: Convert Webpage to PDF Source: https://docs.aspose.com/html/net/how-to-save-a-webpage-as-a-pdf This C# code snippet shows how to load a webpage from a URL and save it as a PDF file using Aspose.HTML for .NET. It includes setting up rendering options for page size and margins. ```csharp using System; using System.IO; using Aspose.Html; using Aspose.Html.Rendering; using Aspose.Html.Rendering.Pdf; using Aspose.Html.Drawing; // How to save a website as a pdf using C# // Set the target webpage URL string url = "https://docs.aspose.com/html/"; // Define the output path (OutputDir is assumed to exist) string outputPath = Path.Combine(OutputDir, "website.pdf"); // Load the HTML document from the specified URL HTMLDocument document = new HTMLDocument(url); // Configure PDF rendering options PdfRenderingOptions options = new PdfRenderingOptions(); options.PageSetup.AnyPage = new Page(new Size(1920, 1080)); // Create a PDF rendering device with the defined options and output file PdfDevice device = new PdfDevice(options, outputPath); // Initialize the HTML renderer HtmlRenderer renderer = new HtmlRenderer(); // Render the document to the specified device renderer.Render(device, document); // Dispose of resources renderer.Dispose(); device.Dispose(); document.Dispose(); ``` -------------------------------- ### HTML Example for Child Selector Source: https://docs.aspose.com/html/net/tutorial/css-selectors Illustrates the effect of the CSS child selector. Only the paragraph directly inside the div receives the background color. ```html

CSS Child Selector (>). Paragraph 1 is in a div.

Paragraph 2 is in a div but inside a section element. It is not a direct child of the div element that matches the first selector. Therefore, there is no background color!

Paragraph 3 is not in the div at all.

``` -------------------------------- ### Convert EPUB to XPS Step-by-Step Source: https://docs.aspose.com/html/net/convert-epub-to-xps This snippet provides a detailed method for converting EPUB to XPS. It involves opening the EPUB file, creating XpsSaveOptions, and then calling the ConvertEPUB method. ```csharp // Convert EPUB to XPS in C# // Open an existing EPUB file for reading using FileStream stream = File.OpenRead(DataDir + "input.epub"); // Prepare a path to save the converted file string savePath = Path.Combine(OutputDir, "input-output.xps"); // Create an instance of XpsSaveOptions XpsSaveOptions options = new XpsSaveOptions(); // Call the ConvertEPUB() method to convert EPUB to XPS Converter.ConvertEPUB(stream, options, savePath); ``` -------------------------------- ### Get Accessibility Principle by Code Source: https://docs.aspose.com/html/net/web-accessibility-rules Retrieves and displays the code and description of an accessibility principle using its code. Requires initialization of the WebAccessibility container. ```csharp 1// Retrieve and display the code and description of an accessibility principle by its code 2 3// Initialize a webAccessibility container 4WebAccessibility webAccessibility = new WebAccessibility(); 5 6// Get the principle by code 7Principle rule = webAccessibility.Rules.GetPrinciple("1"); 8 9// Get code and description of principle 10Console.WriteLine("{0}:{1}", rule.Code, rule.Description); // output: 1:Perceivable ``` -------------------------------- ### Programmatic HTML to PDF Conversion with Options (C#) Source: https://docs.aspose.com/html/net/convert-html-to-pdf This example demonstrates converting an HTML document to various formats, including PDF, using different save options. It requires specifying the input document and output file name. ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var document = new HTMLDocument("{{input lower}}"); {{#if_output 'PDF'}} var options = new PdfSaveOptions(); {{/if_output}} {{#if_output 'MHTML'}} var options = new MHTMLSaveOptions(); {{/if_output}} {{#if_output 'DOCX'}} var options = new DocSaveOptions(); {{/if_output}} {{#if_output 'XPS'}} var options = new XpsSaveOptions(); {{/if_output}} {{#if_output 'MD'}} var options = new MarkdownSaveOptions(); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF'}} var options = new ImageSaveOptions(ImageFormat.{{output param2 camel}}); {{/if_output}} {{#if_output 'BMP' 'JPG' 'GIF' 'PNG' 'TIFF' 'PDF' 'MHTML' 'MD' 'XPS' 'DOCX'}} Converter.ConvertHTML(document, options, "output.{{output lower}}"); {{/if_output}} {{#if_output 'XHTML'}} document.Save("output.xhtml", new HTMLSaveOptions() { DocumentType = HTMLSaveOptions.XHTML }); {{/if_output}} ``` ```csharp using Aspose.Html; using Aspose.Html.Converters; using Aspose.Html.Saving; using var document = new HTMLDocument("document.html"); var options = new PdfSaveOptions(); Converter.ConvertHTML(document, options, "output.pdf"); ``` -------------------------------- ### HTML for Color Contrast Example Source: https://docs.aspose.com/html/net/color-contract-accessibility This HTML code defines styles for elements with good and bad color contrast, intended for use with accessibility checks. ```html
Good contrast
Bad contrast
``` -------------------------------- ### HTML Document Structure Example Source: https://docs.aspose.com/html/net/tutorial/what-is-html-dom This HTML structure illustrates how a document is represented as a tree in memory, with a document object at the root and nested elements forming branches. ```html 2 3 HTML document tree 4 5 6

HTML DOM

7

HTML DOM is a programming interface for HTML documents.

8 9 ``` -------------------------------- ### Create Complex HTML Document and Convert to PDF Source: https://docs.aspose.com/html/net/edit-html-document This example shows how to create a more complex HTML document by adding a style element to the head and a paragraph with a specific class to the body. It also demonstrates converting the generated HTML to a PDF file. ```csharp 1// Create and add new HTML elements using C# 2 3// Create an instance of an HTML document 4using (HTMLDocument document = new HTMLDocument()) 5{ 6 // Create a