Full size screenshot
Take a snapshot of a whole web page into one image, without scrollbars.
Besides the HTML to PDF converter, ExpertPdf offers an HTML to image converter, included in the same assembly. Capture a URL or an HTML string as a JPG, PNG, BMP, GIF or TIFF image: a thumbnail of a website page or a full size screenshot, from C# or VB.NET.
Just like the PDF converter, the image converter supports HTML5 and CSS3. Save the image on disk, get it as
a byte array, or as a System.Drawing.Image object.
Documentation · Online samples · NuGet · NuGet for .NET Framework · Download .zip (v22.0.0)
Capture URLs, HTML strings and local files as images in the standard formats, with the same HTML5 and CSS3 support as the PDF converter.
Web pages and HTML strings, over HTTP, HTTPS or from a local file. The whole page or a fixed browser window.
Take a snapshot of a whole web page into one image, without scrollbars.
Generate a thumbnail image of a website page.
Retrieve the page to capture over HTTP or HTTPS, or from a local file, or convert an HTML string with a base URL for its relative paths.
Just like the PDF converter, the image converter supports the modern HTML5 and CSS3 tags, with the same rendering engines, selected with the RenderingEngine property.
The same methods for every format: pass a different System.Drawing.Imaging.ImageFormat value.
Convert HTML to PNG with ImageFormat.Png.
Convert HTML to JPG with ImageFormat.Jpeg.
Convert HTML to BMP with ImageFormat.Bmp.
Convert HTML to GIF with ImageFormat.Gif.
Convert HTML to TIF with ImageFormat.Tiff.
Disk or memory. Timeouts and delays for slow pages. A multithreaded architecture.
Save the generated image to a file, or get it as a byte array to store or send over HTTP.
System.Drawing.ImageGet the result as an Image object to process further in your application.
Set the number of seconds the converter waits for the web page to load.
Capture with the new Chromium engine (CEF 154) or with Blink (Chromium 148), with a transparent background when the page has none.
Asynchronous methods with cancellation, such as GetImageBytesFromUrlAsync, and a time limit for one capture with MaxConversionTime.
Wait an additional number of seconds after the page loads, for content loaded asynchronously, before the snapshot is taken.
A multithreaded architecture for the simultaneous processing of multiple requests.
Works in 32-bit and 64-bit environments, with no printer driver or third party tools. Assemblies for .NET 2.0 and .NET 4.0 or above, and NuGet packages for .NET Core and .NET 5 to .NET 10.
Create an ImgConverter with the browser window size, then convert a URL, an HTML string or an HTML file. The Thumbnail tabs scale the captured page down to a thumbnail. C# and VB.NET samples ship with the download.
using System.Drawing.Imaging; using ExpertPdf.HtmlToPdf; // A 1024 pixels wide browser window. The height is detected // from the page, so the image shows the whole page. var imgConverter = new ImgConverter(1024); imgConverter.LicenseKey = "your license key"; // Wait up to 60 seconds for the page to load, then 2 more // seconds for content loaded by scripts imgConverter.NavigationTimeout = 60; imgConverter.ConversionDelay = 2; // A URL to a PNG file imgConverter.SaveImageFromUrlToFile("https://www.example.com/", ImageFormat.Png, "page.png"); // An HTML string to JPEG bytes; the base URL resolves relative paths string html = File.ReadAllText("page.html"); byte[] jpg = imgConverter.GetImageBytesFromHtmlString(html, ImageFormat.Jpeg, "https://www.example.com/");
Install with dotnet add package ExpertPdf.HtmlToPdf.NetCore, the same package as the HTML to PDF Converter. The API reference describes the ImgConverter class and its methods.
Common questions about capturing pages, image formats and slow pages.
PdfConverter class produces a PDF document, the ImgConverter class produces an image.System.Drawing.Imaging.ImageFormat value, such as ImageFormat.Png or ImageFormat.Jpeg.new ImgConverter(1024): the height is detected from the page and you get a snapshot of the whole web page in one image, without scrollbars.System.Drawing.Image with GetImageFromUrl, then scale the image down to the thumbnail size, for example with a new Bitmap of the size you need. The Thumbnail tab of the code sample shows how.NavigationTimeout, the number of seconds the converter waits for the page to load (60 by default), and ConversionDelay, an additional number of seconds to wait for content loaded asynchronously before the snapshot is taken.SaveImageFromUrlToFile), as a byte array (GetImageBytesFromUrl) or as a System.Drawing.Image object (GetImageFromUrl). The same methods exist for HTML strings, HTML files and HTML streams.ExpertPdf.HtmlToPdf.NetCore NuGet package works with .NET Core and .NET 5 to .NET 11. The converter works in 32-bit and 64-bit environments, needs no printer driver or third party tools, and has a multithreaded architecture for processing several requests at the same time.Download the free trial of the HTML to PDF Converter, which includes the HTML to Image Converter, with C# and VB.NET samples. When you are ready, license it on the pricing page.