Multipurpose (UI Controls / Image generation), 100% managed (C#), High performance HTML Rendering library for WPF. HTML UI in .NET WPF applications using controls or static rendering. Features and Benefits: --- * Controls: HtmlPanel, HtmlLabel. * Create images from HTML snippets. * 100% managed code and no external dependencies, no ActiveX, no MSHTML. * Extensive HTML 4.01 and CSS level 2 specifications support. * Support separating CSS from HTML by loading stylesheet code separately. * Support text selection, copy-paste and context menu. * Handles "real world" malformed HTML, it doesn't have to be XHTML. * Supports .NET 3.0 or higher including Client Profile. * Lightweight, only two DLLs (~300K). * High performance and low memory footprint. * Extendable and configurable.
$ dotnet add package HtmlRenderer.WPFThis library provides the rich formatting power of HTML in your WPF .NET applications using simple controls or static rendering code. For more info see HTML Renderer on GitHub: https://github.com/ArthurHub/HTML-Renderer
HTML Renderer Demo application showcases HTML Renderer capabilities, use it to explore and learn on the library: https://codeplexarchive.org/ProjectTab/Wiki/HtmlRenderer/Documentation/Demo%20application
If you have problems, wish to report a bug, or have a suggestion, please open an issue on the HTML Renderer issue page: https://github.com/ArthurHub/HTML-Renderer/issues
For full release notes and all versions see: https://github.com/ArthurHub/HTML-Renderer/releases
For more Quick Start see: https://codeplexarchive.org/ProjectTab/Wiki/HtmlRenderer/Documentation/Documentation
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300"
xmlns:wpf="clr-namespace:TheArtOfDev.HtmlRenderer.WPF;assembly=HtmlRenderer.WPF">
<Grid>
<wpf:HtmlPanel Text="<p> <h1> Hello World </h1> This is html rendered text</p>"/>
</Grid>
</Window>
class Program
{
private static void Main(string[] args)
{
BitmapFrame image = HtmlRender.RenderToImage("<p><h1>Hello World</h1>This is html rendered text</p>");
var encoder = new PngBitmapEncoder();
encoder.Frames.Add(image);
using (FileStream stream = new FileStream("image.png", FileMode.OpenOrCreate))
encoder.Save(stream);
}
}