Download ACA WebThumb ActiveX |
For Windows 7/Vista/2003/XP/2000
This article shows a solution for taking screenshot of web page with ASP. To add this feature in your ASP project, you can try ACA WebThumb ActiveX - a web page to image developer SDK. It helps your general screenshot of given URLs in batch with a few fuction calls.
Script file: screenshot.asp
<% '--------------------------------------------------------------------------------------- ' Script: ' screenshot.asp ' Remark: ' This sample script shows how to take screenshot of web page with ASP and then ' save as a PNG image file. ' Parameter: ' url: the web page URL. The default value is http://en.wikipedia.org/wiki/Screenshot ' Example: ' http://localhost/screenshot.asp ' http://lccalhost/screenshot.asp?url=http://www.google.com '--------------------------------------------------------------------------------------- ' 1. Set the save folder and get image parameters ' [IMPORTANT NOTE]: ' This sample saves the snapshot to the folder on the work folder 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: ' t_strSaveFolder = "c:/my-folder" t_strSaveFolder = Server.MapPath("./") ' 2. Get the parameters t_strURL = request.QueryString("url") If ("" = t_strURL) Then t_strURL = "http://en.wikipedia.org/wiki/Screenshot" End If ' 3. Create instance ACAWebThumb.ThumbMaker err = 0 set t_xThumbMaker = server.createobject("ACAWebThumb.ThumbMaker") If ( err <> 0 ) then Response.write("Call Createobject(ACAWebThumb.ThumbMaker) Failed. Error Code: " & err & "<br>") Response.end() End If ' 4. Set the URL and start snap t_xThumbMaker.SetURL (t_strUrl) t_iResult = t_xThumbMaker.StartSnap() If 0 = t_iResult Then ' snap successful, save the image with full size. t_strLargeImage = t_strSaveFolder & "/screenshot-large.png" t_bRet1 = t_xThumbMaker.SaveImage(t_strLargeImage) ' save thumbnail (Size: 320x240) t_strSmallImage = t_strSaveFolder & "/screenshot-small.png" call t_xThumbMaker.SetThumbSize(320, 240, 0) t_bRet2 = t_xThumbMaker.SaveImage(t_strSmallImage) ' show the image If ( t_bRet1 AND t_bRet2 ) Then Response.Write("<b>The snapshot from "+t_strURL+"</b>:<br><br>") Response.Write("<a href='main-thumb.large.png'><img src='main-thumb.small.png' ><br></a>") else Response.Write("ERROR: Can't save the snapshot to file <br>") Response.Write("Please make sure the script has the WRITE permission in this folder.") End If Else Response.Write("ERROR: Snap from "+t_strURL+" failed.<br>") End If set t_xThumbMaker = Nothing %>
Download ACA WebThumb ActiveX |
For Windows 7/Vista/2003/XP/2000