HTML is a web format file supported by the most web browsers. It is the most popular markup language used for building web pages. Users can only see the text and other formatted elements of the web page. You may need to save a web page for later or offline reference. Yet it might be inconvenient to save different information or data from Internet as HTML format.

You may say I can directly take a screen capture of the web page. Yeah, this works for a single or simple web page. But how it works for the entire or long web page? Capture one by one? Certainly not. To show the entire page in a presentation, it would be more easier to convert HTML web page to other formats for better viewing and processing, like converting HTML to image file formats.

HTML to image converters on the market are designed to automate your tasks that helps to save a lot of time clicking and waiting. One of the cheapest .NET library that can perform HTML to image conversion in C# is XsHtml .NET HTML to PDF SDK. XsHtml .NET HTML to PDF SDK is an all-in-one tool for converting HTML web pages, strings, and streams to images(only support JPG/JPEG, PNG, and BMP formats)

How to Convert HTML to Image in C# Class

With this .NET HTML to image converter SDK, the process of converting web pages or HTML strings and streams to image format (JPG/PNG/BMP) in C# is simple and fast. Through a variety of customization options, you have the total control over the output image file. Below is a simple example to convert HTML to image in C# Class.

string html = @"sample.html";
string savePath = "sample.jpg";

// Create a Html converter instance 
HtmlToImageConverter converter = new HtmlToImageConverter();

// Set output image size
converter.ImageHeight = 500;
converter.ImageWidth = 800;

// Convert html to image
converter.ConvertFromFile(html, savePath);

Notice - If you use the free trial version of .NET HTML to PDF SDK, the image quality is 50% of its original.