Convert HTML, SVG, EPUB, MHTML, and Markdown in C#

Aspose.HTML for .NET converts web document formats in C# through the Converter facade and rendering APIs. Use this section to choose the right input format guide, then open the task-specific article for PDF, XPS, DOCX, image, MHTML, or Markdown output.

Aspose.HTML for .NET supports conversion workflows for HTML, SVG, MHTML, EPUB, and Markdown documents. Most tasks use a predictable pattern: load or provide the source content, create a save options object for the target format, and call a method on the Converter class. When you need lower-level rendering control, use RenderTo() with rendering devices and rendering options.

Choose a Converter Guide

Conversion API Patterns

  1. Use the Converter class for direct format conversion when you want the shortest path from source document to output file. It provides format-specific methods such as ConvertHTML(), ConvertSVG(), ConvertMHTML(), ConvertEPUB(), and ConvertMarkdown().
  2. Use RenderTo() and rendering devices when your application needs explicit control over rendering output, output streams, or device-specific options. The Fine-Tuning Converters section explains when to use PdfDevice, XpsDevice, DocDevice, ImageDevice, renderers, and rendering options instead of a direct converter method.

HTML to PDF Example

The following C# example shows the common conversion pattern: provide HTML content, create PdfSaveOptions, and call Converter.ConvertHTML() to write a PDF file.

1// Convert HTML to PDF using C#
2
3// Invoke the ConvertHTML() method to convert HTML to PDF
4Converter.ConvertHTML(@"<h1>Convert HTML to PDF!</h1>", ".", new PdfSaveOptions(), Path.Combine(OutputDir, "convert-with-single-line.pdf"));

For a full workflow with input files, custom PdfSaveOptions, and output stream providers, see Convert HTML to PDF in C#.

Special Conversion Workflows

Other Platforms

Try Online Conversion

Use the free online Converters for quick manual checks. Use Aspose.HTML for .NET when the same conversion workflow must run inside a C# application, service, batch job, or document pipeline.

Free Online Converters