Skip to content
Dean Lunz edited this page Jul 29, 2017 · 1 revision

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

Quick start Demo application Image generation PDF generation Rendering SVG images HTML and CSS support FAQ

Quick start

Install

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: HTML WinForms (HtmlRenderer.WinForms) HTML WPF (HtmlRenderer.WPF) Mono (HtmlRenderer.Mono) PDF using PdfSharp (HtmlRenderer.PdfSharp) WinForms HtmlPanel

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

    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;
    Controls.Add(htmlPanel);
}

} WPF HtmlPanel

In window (Window1) XAML add the following: <wpf:HtmlPanel Text="<p> <h1> Hello World </h1> This is html rendered text</p>"/> 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("

Hello World

This is html rendered text"); 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("

Hello World

This is html rendered text", PageSize.A4); pdf.Save("document.pdf"); } } Demo application

Demo application

Clone this wiki locally