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 » C# capture web page to image

How to capture web page to image with C# - C# Sample Code(2)

This article shows a solution for capturing web page to image with C#. Many capture examples shows how to capture a screenshot from desktop, but do not show how to capture an entire web page as an image. To capture web page to image with C#, you can use our developer SDK - ACA WebThumb ActiveX, with a few function calls in Visual C#(C-sharp), it takes the snapshots of given URLs as JPG, GIF, PNG, BMP, TIFF, WMF and EMF image, it helps you capture the HTML web page to images in batch, capture full length website screenshots, generate thumbnail image previews of web pages.

Guidelines: Caputre web page to image in C#

  1. Free download the HTML Converter SDK - ACA WebThumb ActiveX, and then install it.
  2. You will find a C# demo project in the folder {install-folder}\sample\c#.
  3. You can open this C# demo project with VS2003 or VS2005, build and run it.

Free Trial ACA WebThumb ActiveX Now

C# Sampe Code(2): Capture web page to image

An example for C#:

// C# - Capture web page to image

// Set the image filename.
// [IMPORTANT NOTE]: 
// This sample saves the snapshot to the folder on the work dir of this script. 
// Please make sure the script has the WRITE permission in this folder.
// You can also set the value to other folder, for example: 
//   string t_strSaveFolder = "c:/temp";
string t_strSaveFolder = Server.MapPath("./");           
string t_strLargeImage = t_strSaveFolder + "\\" + "full.png";
string t_strSmallImage = t_strSaveFolder + "\\" + "small.png";

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

// Start capture web page from http://www.google.com
t_xThumbMaker.SetURL("http://www.google.com");
t_xThumbMaker.StartSnap();

// Save the captured web page to image with full size in C#
t_xThumbMaker.SaveImage(t_strLargeImage);

// Save the captured web page to image with 320x240 in C#
t_xThumbMaker.SetThumbSize(320, 240, 0);
t_xThumbMaker.SaveImage(t_strSmallImage);

// Show the image
pictureBox1.Image = Image.FromFile(t_strSmallImage);
pictureBox2.Image = Image.FromFile(t_strLargeImage);

Free Trial ACA WebThumb ActiveX Now

Other resource about Capturing web page 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 (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)?
  • C# Sample Code (5): How to take snapshot from HTML in C# (C-sharp)?
  • Java Sample Code: How to convert HTML to image in Java?
  • PHP Sample Code(1): How to convert HTML to image with PHP?
  • PHP Sample Code(2): How to convert webpage to image with PHP?
  • .Net Sample Code: How to convert HTML to image in ASP.Net??
  • FAQ: Which image format is best?
  • FAQ: What programming languages does ACA WebThumb ActiveX Control support?
  • 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!