html convert

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Stanley Jiang (jiangshiyu2000_at_yahoo.ca)
Date: 09/10/04


Date: Thu, 9 Sep 2004 17:00:41 -0700

I installed html viewer on my computer.The Html Viewer Service and Load
Balancing service are both launched. When I tried to call the service as
below, the last line always return: chi.ce =CE_OTHER and couldn't get the
html result. It was working well when I run in the batch mode, so I think
the problem is on the service or the input parameters.
Is there anybody have some ideas about this.

Thanks,
Stanley

void DisplayHtml(System.Web.HttpResponse response, string
strLoadBalancerUri,
  string strDocument, byte[] rgbData)
{
  //generate a task name based off of the document name
  string strTask = strDocument;

  //create the load balancer object
  IHtmlTrLoadBalancer htmlTrLoadBalancer = (IHtmlTrLoadBalancer)
     System.Activator.GetObject( typeof(IHtmlTrLoadBalancer),
     strLoadBalancerUri);

  //get the uri for the launcher object
  string strLauncherUri = htmlTrLoadBalancer.StrGetLauncher(strTask);

  //create the launcher object at the uri specified by the load balancer
  IHtmlTrLauncher htmlTrLauncher = (IHtmlTrLauncher)
     System.Activator.GetObject(typeof(IHtmlTrLauncher),
     strLauncherUri);

  //call the launcher to create the html
  CreateHtmlInfo chi = htmlTrLauncher.CHICreateHtml(strLauncherUri,
    rgbData, BrowserType.BT_IE4, strDocument, strTask, 90 /*timeout*/,
true);

  //ensure that the load balancer knows that the task has completed
  htmlTrLoadBalancer.LauncherTaskCompleted(strLauncherUri, strTask);

  //check for errors and output the results
  if(chi.ce == CreationErrorType.CE_NONE && chi.fHasMainFile)
     response.BinaryWrite(chi.rgbMainFile);
}