Download ACA WebThumb ActiveX |
For Windows 7/Vista/2003/XP/2000
If you are ASP developer and want to convert web page to JPG image in your ASP web project, ACA WebThumb ActiveX is your best choise. It's a HTML To Image SDK based ActiveX technology, with a few function calls in your script, it helps your convert web page to JPG/PNG/GIF/TIF/BMP/WMF image format quickly. In this tutorial we will see how we can convert web page from http://www.asp.net to a JPG image file in ASP script codes.
This asp script shows how to convert web page from http://www.asp.net to a JPG image:
<% ' ASP code: Convert web page to JPEG image ' Create instance ACAWebThumb.ThumbMaker set HTML2JPG = server.createobject("ACAWebThumb.ThumbMaker") HTML2JPG.SetURL ("http://www.asp.net") HTML2JPG.StartSnap() ' Save snapshot to JPEG image with full size HTML2JPG.SaveImage("asp-fullsize.jpg") ' Save snapshot to JPEG image with 320x240 size call HTML2JPG.SetThumbSize(320, 240, 0) HTML2JPG.SaveImage("asp-320x240.jpg") %>
This sample script shows how to load URL list from a file (batch-list.txt) and then batch make the web thumbnail.
The file contents of batch-list.txt:
http://www.google.com http://www.msn.com http://www.asp.net
The ASP script codes:
<% ' 1. Set the save folder and image parameters t_strSaveFolder = Server.MapPath("./") t_iThumbWidth = 240 ' The width of thumbnail. 0: auto calc the height t_iThumbHeight = 0 ' The height of thumbnail. 0: auto calc the height t_strListFile = t_strSaveFolder + "/batch-list.txt" ' 2. Read the URL list to array Set t_xFSO = Server.CreateObject("Scripting.FileSystemObject") Set t_xFile = t_xFSO.OpenTextFile( t_strListFile ) i = 0 Dim t_arrURL() ' as String While Not t_xFile.AtEndOfStream t_strUrl = t_xFile.ReadLine() If t_strUrl <> "" Then i = i + 1 ReDim Preserve t_arrURL(i) t_arrURL(i) = t_strURL End If WEnd t_iCount = i ' 3. Create instance ACAWebThumb.ThumbMaker err = 0 Set ThumbMaker = server.createobject("ACAWebThumb.ThumbMaker") If ( err <> 0 ) then Response.write("call Createobject(ACAWebThumb.ThumbMaker) Failed. ErrCode: " & err & "<br>") Response.end() End If ' 4. Set the time out ThumbMaker.SetTimeOut(120) ' Set the time out for each snap task Server.ScriptTimeout = 120*t_iCount ' Set the time out for ASP script ' 5. Take snapshot, convert web page to JPEG image For i = 1 To t_iCount ' For each URL ThumbMaker.SetURL(t_arrURL(i)) t_iResult = ThumbMaker.StartSnap() If ( 0 = t_iResult ) Then ' Convert successful. save to JPG image with full size. t_strLargeImage = t_strSaveFolder + "/url-" & i & ".large.jpg" call ThumbMaker.SetThumbSize (0, 0, 0) t_bRet1 = ThumbMaker.SaveImage(t_strLargeImage) ' save thumbnail t_strSmallImage = t_strSaveFolder + "/url-" & i & ".small.jpg" call ThumbMaker.SetThumbSize (t_iThumbWidth, t_iThumbHeight, 0) t_bRet2 = ThumbMaker.SaveImage(t_strSmallImage) ' show the image If ( t_bRet1 AND t_bRet2 ) Then Response.Write("<hr>URL: <a href='"+t_arrURL(i)+"' target=_blank>"+t_arrURL(i)+"</a><br>") Response.Write("<a href='url-" & i & ".large.jpg'><img src='url-" & i & ".small.jpg'></a>") else Response.Write("<hr>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 End If Next %>
Download ACA WebThumb ActiveX |
For Windows 7/Vista/2003/XP/2000