Convert html to image at a given size

You may want to convert html to image. And you want to specify the size of the output image.

Here is the way when you use our awarding winning component htmlsnapshot. The demo is coded with VBscript.

‘demo how to convert html to image

Dim snap

‘Create the Html Snapshot Object
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)

‘Set the time to wait for web page loading
snap.SetTimeOut CLng(200000)

‘You can control JPEG compression quality here
snap.SetJPEGQuality 100

‘Get the cookie
‘MsgBox snap.GetCookie2(“http://www.google.com/“)

‘Set the browser window size
snap.SetSnapDimension 500, 500

‘Set this if you want the image size exactly to be 1000,1000
snap.EnableSnapDimensionAsImageSize 1

‘Begin to capture the web page
snap.SnapUrl “http://www.google.com/“, “google.jpg”
‘Free object
Set snap = Nothing
The key methods are SetSnapDimension and EnableSnapDimensionAsImageSize