Provide state-of-the-art image capture, screen capture, video capture and audio capture software
Home     Download     Purchase     Support     Contact     View my shopping cart
You are here: ACASystems » ACA WebThumb ActiveX Control » FAQ » Convert HTML to image in ASP.Net

How to convert HTML to image in ASP.net - ASP.Net Sample Code

If you are an ASP.Net developer, you may want to convert HTML to image in your .Net desktop program or web application. To add HTML to JPEG, HTML to PNG feature to your .Net application, you can try our developer SDK - ACA WebThumb ActiveX. With a few function calls in your .Net application, it converts the HTML web pages of given URLs to the image files (JPG, GIF, PNG, BMP, TIFF, WMF and EMF). You can also get the HBITMAP handle or image bytes in memory.

Guidelines: Add converting HTML to image feature to .Net application

  1. Free download the HTML to Image SDK - ACA WebThumb ActiveX first, and then install it on your computer.
  2. You will find C# and VB.net demo projects in the folder {install-folder}\sample\.
  3. You can open these demo projects with VS2003 or VS2005, build and run it.

Free Trial ACA WebThumb ActiveX Now

.Net Example code: Convert HTML to image in C#

// C# sample code: convert HTML to image
// Set the image filename.
string t_Image_Save_Folder = Server.MapPath("./");           
string t_Full_Image_File = t_Image_Save_Folder + "\\" + "thumbnail.full.png";
string t_Small_Image_File = t_Image_Save_Folder + "\\" + "thumbnail.small.png";

// Create instance
ThumbMakerClass HTML2IMAGE = new ACAWebThumbLib.ThumbMakerClass();

// Start convert web page http://www.acasystems.com to image
HTML2IMAGE.SetURL("http://www.acasystems.com");
HTML2IMAGE.StartSnap();

// Save the image with full size in C#
HTML2IMAGE.SaveImage(t_Full_Image_File);

// Save the image with 320x240 in C#
HTML2IMAGE.SetThumbSize(320, 240, 0);
HTML2IMAGE.SaveImage(t_Small_Image_File);

.Net Example code: Convert HTML to image in VB.net

' VB.net sample code: convert HTML to image, save as JPEG format
' Set the image files
Dim t_strSaveFolder = Application.StartupPath
Dim t_strLargeImage = t_strSaveFolder & "\\web-thumbnail.large.jpeg"
Dim t_strSmallImage = t_strSaveFolder & "\\web-thumbnail.small.jpeg"

' Start the snap task
Dim HTML2JPG As New ACAWebThumbLib.ThumbMaker
HTML2JPG.SetURL("http://www.acasystems.com")
HTML2JPG.StartSnap()
' Save the HTML to image with full size
HTML2JPG.SaveImage(t_strLargeImage)
' Save the HTML to image with 240x180
HTML2JPG.SetThumbSize(240, 180, 0)
HTML2JPG.SaveImage(t_strSmallImage)
' Show the image in the picture box control
pictureBox1.Image = Image.FromFile(t_strSmallImage)
pictureBox2.Image = Image.FromFile(t_strLargeImage)

Free Trial ACA WebThumb ActiveX Now

Other resource about Converting HTML to image in C#:

  • ASP Sample Code: How to convert HTML to image with ASP?
  • C# Sample Code(1): How to convert HTML to image in C#(C-sharp)?
  • C# Sample Code(2): How to capture web page to image with C#(C-sharp)?
  • C# Sample Code(3): How to generate image from HTML with C#(C-Sharp)?
  • C# Sample Code (4): How to take screenshot of web page in C#(C-sharp)?
  • FAQ: Which image format is best?
  • FAQ: What programming languages does ACA WebThumb ActiveX Control support?
  • FAQ: How to convert HTML to image with PHP?
  • ACA WebThumb ActiveX Interface Reference
  • Free Download ACA WebThumb ActiveX Control
  • Wikipedia.org: C Sharp(C#)
  • Microsoft MSDN: Visual C# Developer Center

  • Get discount alerts, new product information and technical articles:
    Name:
    Email:
    * Get 10% off your first order by joining our mailing list!
    * You may safely unsubscribe at any time!