Archive for August, 2006

Convert SVG to image

Thursday, August 31st, 2006

Htmlsnapshot can convert html with SVG to image as well. To do this, you need to install the free SVG plugin from Adobe.
http://www.adobe.com/svg/viewer/install/main.html
Then the web page with SVG can be snapped simply like a normal web page.
And html with SVG need to put on a web server, not local disk since by default, the web browser will [...]

Difference between CreateObject calls

Tuesday, August 29th, 2006

Excellent explanations:
http://blogs.msdn.com/ericlippert/archive/2004/06/01/145686.aspx

Save html to gif

Wednesday, August 23rd, 2006

Htmlsnapshot supports converting html to gif. And it supports creating transparent GIF as well.
The SetGIFOption can be used to enable or disable transparent Gif
Dim snap
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
snap.SetTimeOut CLng(200000)
‘disable transparency gif
snap.SetGIFOption FALSE, &HFFFFFFFF
snap.SnapUrl “http://www.google.com/“, “0.gif”
‘enable transparency gif
snap.SetGIFOption TRUE, &HFFFFFFFF
snap.SnapUrl “http://www.google.com/“, “1.gif”
 
 

Create high quality image from html

Tuesday, August 15th, 2006

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:\temp\rptfile_200608140039.html”, “zoom.tif”
Set snap = Nothing
2.  generate a metafile [...]

Convert VML To image

Wednesday, August 9th, 2006

VML is a kind of vector based graphic format.
html snapshot can convert VML to image like jpg, tiff etc. 
In Win2003, there is an “IE enhanced security” component which may restrict some behaviour of rending vml to image.  
So to make  vml to image work correctly, it is safer to remove the security component from Windows.  You can do [...]

Write image back to browser

Sunday, August 6th, 2006

Want to send an image from php to browser?  You can use code like this
< ?php
header('Content-type: image/jpg');
readfile('your.jpg');
?>
 
For using with htmlsnapshot, the code is like this
 < ?php
$snap = new COM("HTMLSNAP2.HtmlSnap.1");
header('Content-type: image/jpg');
$snap->SnapUrl(www.google.com, “*”)
print $snap->GetImageBytes(“*.jpg”)
?>