How to Convert HTML to Image in ASP.Net ?

If you are ASP.NET developer and you want to convert HTML to image in your .NET web/windows application. To add HTML to JPEG, HTML to PNG, HTML to BMP, HTML to TIF or HTML to GIF feature to your .NET application, you can try our .NET developer SDK for HTML to Image. With a few lines of code in your .NET application, it converts HTML web pages of given URLs to the image files (JPG, GIF, PNG, BMP and TIFF).

Download HTML to Image for .NET and install it on your computer, with a few function calls, it takes the snapshots of given URLs as JPG, GIF, PNG, BMP and TIFF image, it helps you convert the web page to images in batch, capture full length website screenshots, generate thumbnail image previews of web pages.


The following code sample shows you how to convert HTML web page to PNG Image format in ASP .NET. Pass your URL in CaptureWebpage method and set your image format before you save your resulted image.

C# .Net Code.

    
WebsitesScreenshot.WebsitesScreenshot  _Obj;
_Obj = new WebsitesScreenshot.WebsitesScreenshot ();
WebsitesScreenshot.WebsitesScreenshot.Result _Result;
_Result = _Obj.CaptureWebpage("http://www.yahoo.com");
if (_Result == WebsitesScreenshot.WebsitesScreenshot.Result.Captured)
{
	_Obj.ImageFormat = WebsitesScreenshot.
		WebsitesScreenshot.ImageFormats.PNG;
	_Obj.SaveImage ("d:\\yahoo.PNG");
}            
_Obj.Dispose();

VB .Net code.

    
Dim _Obj As New WebsitesScreenshot.WebsitesScreenshot
Dim _Result As WebsitesScreenshot.WebsitesScreenshot.Result
With _Obj
	_Result = .CaptureWebpage("http://www.yahoo.com")
	If _Result = WebsitesScreenshot.WebsitesScreenshot. _
				Result.Captured Then
		.ImageFormat = WebsitesScreenshot. _
				WebsitesScreenshot.ImageFormats.PNG
		.SaveImage("d:\yahoo.png")
	End If
End With
_Obj.Dispose()