How to Convert HTML to JPG with C# (C-Sharp)?

Are you looking for a solution to convert html to jpeg in your C-Sharp .NET project? Our HTML to Image for .NET Library is one of the best choice to convert long html web page to JPG, PNG, GIF, BMP and TIF format with a few lines of code. Using CaptureWebpage method you can convert your url to Image or your local html web page to image and using CaptureHTML method you can convert your html code to image. You can save resulted image in your local drive or get it in memory bitmap object.

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 JPG Image format using url in VB and c# (C-Sharp) .NET. Pass your web page url in CaptureWebpage method and call SaveImage method to get resulted image.

C# .Net Code.

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

VB .Net code.

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