IHtmlTrLauncher.CHICreateHtml Method
NOTE: This API is now obsolete.
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
'Declaration
<ObsoleteAttribute("Use IDocumentConversionsLauncher instead")> _
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
'Usage
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)
[ObsoleteAttribute("Use IDocumentConversionsLauncher instead")]
CreateHtmlInfo CHICreateHtml(
string strLauncherUri,
byte[] rgbFile,
BrowserType bt,
string strReqFile,
string strTaskName,
int timeout,
bool fReturnFileBits
)
Parameters
strLauncherUri
Type: System.StringSpecifies 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.BrowserTypeSpecifies the target browser type by using a constant from the BrowserType enumeration.
strReqFile
Type: System.StringThe URL of the document to convert.
strTaskName
Type: System.StringThe document conversion task name, which the load balancer uses to keep track of the request.
timeout
Type: System.Int32The time in seconds before the document conversion times out.
fReturnFileBits
Type: System.BooleanSpecifies 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);
}
Imports Microsoft.HtmlTrans
Private Sub DisplayHtml(ByVal response As System.Web.HttpResponse, ByVal strLoadBalancerUri As String, ByVal strDocument As String, ByVal rgbData() As Byte)
'generate a task name based off of the document name
Dim strTask As String = strDocument
'create the load balancer object
Dim htmlTrLoadBalancer As IHtmlTrLoadBalancer = CType(System.Activator.GetObject(GetType(IHtmlTrLoadBalancer), strLoadBalancerUri), IHtmlTrLoadBalancer)
'get the uri for the launcher object
Dim strLauncherUri As String = htmlTrLoadBalancer.StrGetLauncher(strTask)
'create the launcher object at the uri specified by the load balancer
Dim htmlTrLauncher As IHtmlTrLauncher = CType(System.Activator.GetObject(GetType(IHtmlTrLauncher), strLauncherUri), IHtmlTrLauncher)
'call the launcher to create the html
Dim chi As CreateHtmlInfo = htmlTrLauncher.CHICreateHtml(strLauncherUri, rgbData, BrowserType.BT_IE4, strDocument, strTask, 90, True) 'timeout
'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 AndAlso chi.fHasMainFile Then
response.BinaryWrite(chi.rgbMainFile)
End If
End Sub