IHtmlTrLauncher.CHICreateHtml Method
Starts the process of converting a document to HTML format for viewing in the browser by a user who does not have the appropriate client application or viewer installed.
Namespace: Microsoft.HtmlTrans
Assembly: Microsoft.HtmlTrans.Interface (in Microsoft.HtmlTrans.Interface.dll)
Syntax
Function CHICreateHtml ( _
strLauncherUri As String, _
rgbFile As Byte(), _
bt As BrowserType, _
strReqFile As String, _
strTaskName As String, _
timeout As Integer, _
fReturnFileBits As Boolean _
) As CreateHtmlInfo
Dim instance As IHtmlTrLauncher
Dim strLauncherUri As String
Dim rgbFile As Byte()
Dim bt As BrowserType
Dim strReqFile As String
Dim strTaskName As String
Dim timeout As Integer
Dim fReturnFileBits As Boolean
Dim returnValue As CreateHtmlInfo
returnValue = instance.CHICreateHtml(strLauncherUri, _
rgbFile, bt, strReqFile, strTaskName, _
timeout, fReturnFileBits)
CreateHtmlInfo CHICreateHtml(
string strLauncherUri,
byte[] rgbFile,
BrowserType bt,
string strReqFile,
string strTaskName,
int timeout,
bool fReturnFileBits
)
Parameters
- strLauncherUri
Type: System.String
Specifies the server hosting the launcher application by using the value returned by the StrGetLauncher method of the IHtmlTrLoadBalancer interface.
- rgbFile
Type: []
The binary contents of the source file.
- bt
Type: Microsoft.HtmlTrans.BrowserType
Specifies the target browser type by using a constant from the BrowserType enumeration.
- strReqFile
Type: System.String
The URL of the document to convert.
- strTaskName
Type: System.String
The document conversion task name, which the load balancer uses to keep track of the request.
- timeout
Type: System.Int32
The time in seconds before the document conversion times out.
- fReturnFileBits
Type: System.Boolean
Specifies whether to return the binary contents of the converted file (that is, the HTML output) in the rgbMainFile and rgrgbThicketFiles properties of the instance of the CreateHtmlInfo class returned by the CHICreateHtml method.
Return Value
Type: Microsoft.HtmlTrans.CreateHtmlInfo
Microsoft.HtmlTrans.CreateHtmlInfo The HTML output of the conversion process is returned in an instance of the CreateHtmlInfo class, which also contains information about any conversion error that occurred and about additional supporting files that may be part of the output.
Remarks
The CHICreateHtml method starts the process of converting a document to HTML format and returns the HTML output to Microsoft Windows SharePoint Services to forward to the user.
Examples
The following code example shows a simple version of handler page code that calls implementations of the IHtmlTrLoadBalancer and IHtmlTrLauncher interfaces, converts a document by using the CHICreateHtml method, and writes the output of the conversion process to a file.
using Microsoft.HtmlTrans;
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);
}