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.
Free Trial ACA WebThumb ActiveX Now
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