Hi, i already downloaded that program.
Question 1
For the function below, is that 'alertWord' will called first, then follow by 'GetWordAtPoint'? For the x, y, is it the point i clicked on? And how if i wan to pass in the rectangle point?
var go = function() {
WebAnnotationViewer1.RemoteInvoked = alertWord;
WebAnnotationViewer1.RemoteInvoke("GetWordAtPoint", new Array(x, y));
}
Question 2
In GetWordAtPoint function, may i know what is w.Bounds.Contains(new Point(x, y)) doing? And i not understand why everytime i will get the same result for r value for OcrTextRegion, eventhough the image i loaded into WebAnnotationViewer1 is different. What i need to check out to solve this issues?
[RemoteInvokable]
public string GetWordAtPoint(int x, int y)
{
OcrPage p = (OcrPage)Application["ocrPage"];
string val = "";
foreach (OcrTextRegion r in p.Regions)
foreach (OcrLine l in r.Lines)
foreach (OcrWord w in l.Words)
if (w.Bounds.Contains(new Point(x, y)))
val = w.Text;
// This is not the best way to escape single quotes.
// It should be much more robust than this.
return val.Replace("'", "~~");
}
Question 3
When should i call up this two events? Can i called it during OpenImageCallBack() function? Or must called during OnPageLoad() function?
WebAnnotationViewer1.RemoteInvoked = showPanel;
WebAnnotationViewer1.RemoteInvoke("OcrImage", new Array());
function OpenImageCallBack(){
WebAnnotationViewer1.RemoteInvoked = function(){};
WebThumbnailViewer1.OpenUrl(WebAnnotationViewer1.getReturnValue());
Label_FileName.innerHTML = WebThumbnailViewer1.getUrl();
WebAnnotationViewer1.RemoteInvoked = showPanel;
WebAnnotationViewer1.RemoteInvoke("OcrImage", new Array());
}
Question 4
The sample source code not support in IE7? I test out the same copy of source code, it run fine in IE6, but in IE7 it return empty string when i do the click.
Thanks.