Cross framework, Multipurpose, 100% managed (C#), High performance HTML Rendering library.


Quick start


Download the latest release zip, worth having around for the Demo application.
Either reference the proper DLL's from the downloaded release zip: HtmlRenderer.dll and one of: HtmlRenderer.WinForms.dll, HtmlRenderer.WPF.dll, HtmlRenderer.PdfSharp.dll. Note: add the targeted framework dlls you are targeting in your project, for PdfSharp you will also need to download PdfSharp dll.
Or, simply install the proper NuGet package using Visual Studio or command line:

WinForms HtmlPanel

In form (Form1) add the following:
public partial class Form1 : Form
    public Form1()

        TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel htmlPanel = new TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel();
        htmlPanel.Text = "<p><h1>Hello World</h1>This is html rendered text</p>";
        htmlPanel.Dock = DockStyle.Fill;

WPF HtmlPanel

In window (Window1) XAML add the following:
<Window x:Class="Window1"
        Title="Window1" Height="300" Width="300"
        <wpf:HtmlPanel Text="&lt;p&gt; &lt;h1&gt; Hello World &lt;/h1&gt; This is html rendered text&lt;/p&gt;"/>

Generate Image

Add the following snippet in your main method: (for more advance usage see Image generation)
class Program
    private static void Main(string[] args)
        Image image = TheArtOfDev.HtmlRenderer.WinForms.HtmlRender.RenderToImage("<p><h1>Hello World</h1>This is html rendered text</p>");
        image.Save("image.png", ImageFormat.Png);

Generate PDF

Add the following snippet in your main method: (for more advance usage see PDF generation)
class Program
    private static void Main(string[] args)
        PdfDocument pdf = PdfGenerator.GeneratePdf("<p><h1>Hello World</h1>This is html rendered text</p>", PageSize.A4);

Demo application

Demo application

Last edited Nov 1, 2014 at 12:48 PM by ArthurTep, version 19


1stQuad_Hofer Mar 9 at 1:01 PM 
Hi! Great work on this!!!

I have only one problem: One of my HTML contains inline images:

<img alt="Image left : 12px, top : 0px" src="data:image/png;base64,iVBORw0KGgoAAAANAASUVORK5......CYII=" style="position:absolute;left:12px;top:0px;border-width:0px;"></div>

Unfortunately the resulting image is completely blank (also the rest of the HTML is not converted).

Am i missing some special configuration? I use plain an simple HtmlRender.RenderToImage(html);

Any help is greatly appreciated!


denis_bda Aug 6, 2016 at 1:31 PM 
Hi Naimishmakwana,

I needed this as well so I threw together a quick example


Naimishmakwana Jun 11, 2016 at 6:18 AM 
can anyone please give me the sample code snippet for use external css to generate pdf form HTML.