Archive for February, 2008

How to run an exe in coldfusion

Tuesday, February 12th, 2008

Cold fusion is a CGI language like asp, php. Sometimes, you may need to call an external exe in coldfusion.

It is absolutely doable in coldfusion. For exmaple, if you want to call cscript.exe, here is what you can do:

<cfexecute name = “C:\Windows\System32\cscript.exe
  arguments = “pdfmerge.vbs  c:\1.pdf|c:\2.pdf  c:\out.pdf”
  outputFile = “C:\Temp\output.txt”
  timeout = “100″>
</cfexecute>

A handy script to convert html to image

Monday, February 11th, 2008

You may need to run a command line utility to convert html or url to image. Here is a handy script that converts url/html to image with our award winning htmlsnapshot product.

Save the below code into a script snapurl.vbs (Or you can find this script in htmlsnapshot\demo\vbscript)

set args = WScript.Arguments
num = args.Count

if num <> 2 then
   WScript.Echo “Usage: [CScript | WScript] snapurl.Vbs Url ImageFile”
   WScript.Quit 1
end if

‘demo how to convert html to image
Dim snap

‘Create the Html Snapshot Object
Set snap = CreateObject(“HTMLSNAP2.HtmlSnap.1″)
snap.SetCode “Input your license code here to remove watermark”
snap.SnapUrl args.Item(0), args.Item(1)
WScript.echo “Snap return:” & CStr(snap.GetErrorCode)

‘Free object
Set snap = Nothing

 After that, you can run on command line like below:

cscript.exe snapUrl.vbs www.google.com g.jpg
cscript.exe snapUrl.vbs file://c:\1.html g.jpg

Capture silverlight web page into image

Thursday, February 7th, 2008

Silverlight is the new web authoring technology proposed by Microsoft. It is implemented as an ActiveX like the Flash.

It can be used to build interactive, vector based web pages.

To convert such web page into image, you can do it with our award winning htmlsnapshot product.