How to Convert Web Page to Image in ASP.Net ?

Sometimes, we want to take screenshot of website page and save screenshot as JPG, PNG, TIF, GIF or BMP format on computer or in memory. To add this feature in your .NET (ASP, C-Sharp and Visual Basic) projects, you can try our .NET assembly HTML to Image - web page to image developer SDK. It helps you capture full length web page screenshot of given URL, generate thumbnail image preview of given URL with single function call.

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.

Following code sample shows you how to convert web page to thumbnail image in ASP.NET. Pass your URL into CaptureWebpage function, set your thumbnail width and height, save your resulted thumbnail. You can also use PreserveAspectRatio property to preserve width or height of thumbnail.

C# .Net Code.

WebsitesScreenshot.WebsitesScreenshot  _Obj;
_Obj = new WebsitesScreenshot.WebsitesScreenshot ();
WebsitesScreenshot.WebsitesScreenshot.Result _Result;
_Result = _Obj.CaptureWebpage("");
if (_Result == WebsitesScreenshot.WebsitesScreenshot.Result.Captured)
	_Obj.ImageWidth = 200;
	_Obj.ImageHeight = 300;
	_Obj.ImageFormat = WebsitesScreenshot.

VB .Net code.

Dim _Obj As New WebsitesScreenshot.WebsitesScreenshot()
Dim _Result As WebsitesScreenshot.WebsitesScreenshot.Result
With _Obj
	_Result = .CaptureWebpage("")
	If _Result = WebsitesScreenshot.WebsitesScreenshot. _
				Result.Captured Then
		.ImageWidth = 200
		.ImageHeight = 300
		.ImageFormat = WebsitesScreenshot. _
	End If
End With