Create high quality image from html

htmlsnapshot generates the image at the screen DPI by default. To get a higher resolution image, there are two methods.

1. Use setzoom and setDPI method.  The following code zooms the image 3 times and set DPI as 300, 300

  Dim snap
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
snap.SetTimeOut CLng(200000)

snap.SetDPI 300, 300
snap.SetZoom 3.0
snap.SnapUrl “d:temprptfile_200608140039.html”, “zoom.tif”

Set snap = Nothing

2.  generate a metafile first and convert it into raster image

 ’Declare object
Dim snap
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
snap.SetTimeOut CLng(200000)

snap.SnapUrl “file://d:temprptfile_200608140039.html“, “2.emf”

snap.SetDPI 300, 300

‘convert emf to tif, keep aspect ratio
snap.ConvertEMFToImage “2.emf”, “1.tif”, 6000, 6000, 1

Set snap = Nothing