HTML to Image Generator for .NET C# WkHtmlToImage Wrapper
features
- Render HTML pages (with floating divs, CSS, images, javascript code) to image (jpg,png) canvas with WebKit engine (based on WkHtmlToImage tool)
- Convert HTML to image (jpg,png) from any .NET application (including ASP.NET WebForms, MVC)
- Generate web page thumbnail (web page screenshot)
- Render SVG to PNG/Jpeg (charts, diagrams) on the server side
- Easy to use WkHtmlToImage C# wrapper library: all you need is one assembly.
In case of .NET Core wkhtmltoimage should be deployed separately. -
Usage examples (C#):
- WebForms: web page preview (take a screenshot of a web page)
- MVC.NET samples:
- export GoogleChart SVG to image
- generate Barcode image from HTML+Javascript
- Looking for HTML to PDF converter? Try NReco.PdfGenerator
download and pricing
Image Generator FREE Binary pack
Examples, NO support, .NET Framework-only |
Download for Free |
Image Generator enterprise source code pack
Includes: component source code, extended license for redistribution and SaaS usage, license key for LT-version (.NET Core compatible), 1 year of email support and free updates |
$99 - Order Now |
quick purchase process
- 1 Choose a package
- 2 Pay online
- 3 Download the package
Need to perform HTML to image conversion from C# code and get similar to web browser rendering result? NReco.ImageGenerator is a right choice!
how to use
- Install NReco.ImageGenerator nuget package
- Render HTML to image with one line of C# code:
var html = String.Format("<body>Hello world: {0}</body>",DateTime.Now); var htmlToImageConv = new NReco.ImageGenerator.HtmlToImageConverter(); var jpegBytes = htmlToImageConv.GenerateImage(html, ImageFormat.Jpeg);
- That's all! Check out online documentation for additional options.
render HTML to image demo
Web page URL:
Notice: don't use intranet/extranet/VPN/local URLs (like 'localhost').
In most cases they are not accessible by our server and require authentication; ImageGenerator will able to convert these pages only when hosted on your server.
In most cases they are not accessible by our server and require authentication; ImageGenerator will able to convert these pages only when hosted on your server.
frequently asked questions
ImageGenerator can be used for FREE in single-deployment projects (websites, intranet/extranet) or applications for company's internal business purposes (redistributed only internally inside the company).
Commercial license is required for:
Commercial license is required for:
- Applications for external redistribution (ISV) or multiple deployments
- SaaS deployments
It is possible to include images by specifying their FULL URL or path (if they're on local filesystem).
External CSS and javascript files are also supported.
ImageGenerator embeds WkHtmlToImage x86 binaries and invokes it in separate process with System.Diagnostics.Process.
In case of ASP.NET applications this might be prohibited in partial trust environments (shared ASP.NET hostings, Azure Apps shared).
Also this means that non-Windows environments are NOT supported by NReco.ImageGenerator nuget package.
- Minimal .NET Framework version is 4.5 (or higher).
- ImageGenerator works fine with Azure VM instances / ServiceFabric. Azure Apps (shared plans) are not supported.
- .NET Core and Mono are supported by special ImageGenerator.LT build that doesn't include wkhtmltoimage binaries (they should be deployed/installed separately). LT build is available only for commercial users (requires a license key).
In some cases image generation fails with one of the following errors:
- Exit with code 1 due to network error: ContentNotFoundError
- Exit with code 1 due to network error: ProtocolUnknownError
- Exit with code 1 due to network error: HostNotFoundError
var htmlToImage = new HtmlToImageConverter(); htmlToImage.CustomArgs = " --load-media-error-handling ignore ";
what's new
2020 Jun 15 |
v.1.2.0 changes:
|
2019 Apr 03 |
v.1.1.3 changes:
|
2018 Nov 23 |
v.1.1.2 changes:
|
2017 Nov 23 |
v.1.1.1 changes:
|
2017 Mar 31 |
v.1.1.0 changes:
|
2015 Sep 10 |
v.1.0.3 changes:
|
2015 Aug 27 |
v.1.0.2 changes:
|
2015 Feb 02 | v.1.0.1: Fixed issue with image format (was ignored) |
2015 Jan 24 | v.1.0: Initial ImageGenerator release based on WkHtmlToImage v.0.12.2.1 |
more components
-
HTML-to-PDF Generator
.NET wrapper for WkHtmlToPdf utility that generates PDF reports by HTML template.
-
PDF-to-Image Renderer
.NET wrapper for poppler tools that converts PDF pages to images or text (ASP.NET PDF viewer, PDF thumbnails, extract PDF text/images).