From: Anx on
Hello Gurus,

I am not a microsoft geek but have a scenario to provide OCR functionality
in browser for a single TIF file. As per MSDN help Microsoft Document Imaging
View control could do it. See here -
http://msdn.microsoft.com/en-us/library/aa167607(office.11).aspx


I have tried different ways and am able to copy selected image block to
clipboard but am not able to do any OCR. I am not using any server side
scripting but only HTML + client side VBscript. Below is the sample code,
could anyone please help in this.

************************CODE***********************************

<HTML>
<HEAD>
<TITLE>New Page</TITLE>
<SCRIPT LANGUAGE="vbscript">
<!--
Option Explicit
Dim doc1
Dim oimage
dim olayout
dim item


Sub Button1_onclick()
'oimage = doc1.images(0)
'olayout = oimage.Layout
'MsgBox olayout.Text
End Sub


Sub Button2_onclick()
Set Doc1 = CreateObject("MODI.Document")
'set oimage = CreateObject("MODI.Image")
'set olayout = CreateObject("MODI.Layout")
set item = CreateObject("MODI.IMiSelectableItem")
Doc1.Create("C:\TEST.TIF")
' miDoc.Create "C:\test.tif"
MiDocView1.object.Document = doc1
'MiDocView1.FileName = "C:\TEST.TIF"
'MsgBox MiDocView1.FileName
End Sub
-->
</SCRIPT>
</HEAD>

<BODY>
<p> </p>
<p> <INPUT TYPE=button VALUE="Button" ID="Button1"
onclick="Button1_onclick">

<INPUT TYPE=button VALUE="Button" ID="Button2" onclick="Button2_onclick">
</p>
<p> </p> <p>

<SCRIPT LANGUAGE="vbscript">
<!--
Sub MiDocView1_CurPageNumChanged()
MsgBox "MiDocView1_CurPageNumChanged"
end sub

Sub MiDocView1_SelectionChanged()
MsgBox "MiDocView1_SelectionChanged"
msgbox doc1.Images.count
'MiDocView1.object.Document.OCR
'MsgBox MiDocView1.TextSelection
'MiDocView1.object.ImageSelection.CopyToClipboard
MiDocview1.imageselection.CopyToClipboard
end sub

Sub MiDocView1_VisibleRectChanged()
MsgBox "MiDocView1_VisibleRectChanged"
end sub

Sub MiDocView1_ScaleChanged()
MsgBox "MiDocView1_ScaleChanged"
end sub

Sub MiDocView1_PageCountChanged()
MsgBox "MiDocView1_PageCountChanged"
end sub

Sub MiDocView1_FitmodeChanged()
MsgBox "MiDocView1_FitmodeChanged"
end sub

Sub MiDocView1_PageChanged()
MsgBox "MiDocView1_PageChanged"
end sub
-->

</SCRIPT>

<OBJECT ID="MiDocView1" WIDTH=841 HEIGHT=489
CLASSID="CLSID:EF347A62-BA21-42E4-94A0-1C0A6D7FDFE7" VIEWASTEXT>
<PARAM NAME="_cx" VALUE="22260">
<PARAM NAME="_cy" VALUE="12947">
<PARAM NAME="ActionState" VALUE="5">
<PARAM NAME="DocViewMode" VALUE="0">
<PARAM NAME="FitMode" VALUE="0">
<PARAM NAME="FileName" VALUE="">
</OBJECT>

</BODY>
</HTML>


************************CODE***********************************
The TextSelection property of MODI control is blank however I could use the
the selected rectangled image to copy to clipboard using "
MiDocview1.imageselection.CopyToClipboard"


Could anybody help in what I am missing.


Thanks,
Anx