Searching / Hilighting OCR text in Office Document and Imaging
Hi,
I have been given following Tasks using MS Document Imaging 11.0 API
Read TIF perform OCR on it
Show it inAxMODI.AxMiDocView
Searching / highlighting text in AxMODI.AxMiDocView using MODI.MiDocSearch class in TIFF file and Highlight search result in the view.
1,2 are Ok but I have not been able to do point 3. Following Is the code I wrote to searching text in the document and but it is not working
Can anyone comment on this
Loading File
MODI.Document_MODIDocument =newMODI.Document();
_MODIDocument.Create(filename);
axMiDocView1.Document =_MODIDocument;
axMiDocView1.Refresh();
Performing OCR
_MODIDocument.OCR(_MODIParameters.Language,_MODIParameters.WithAutoRotation,_MODIParameters.WithStraightenImage);
Searching Text
MODI.MiDocSearchmodiSearch =newMODI.MiDocSearchClass();
MODI.IMiSelectableItemodiTextSel =null;
objectnum=0,word=0,start=0,back=null;
modiSearch.Initialize(_MODIDocument, "a",refnum,refword,refstart,refback,false, false, false, false);
modiSearch.Search(null,refodiTextSel);
axMiDocView1.MoveSelectionToView(odiTextSel);
Thanks,
Wajhi
[6757 byte] By [
wajhi] at [2008-1-9]
Hi Doppalapudi,
Visual studio gives error when you try to add axMODI viewer control through drag and drop on your form.
There is a work around to that.Following are the steps for using the AxMODI control in window forms
1. You add reference to the AxMODI activeX component to your project by right clicking to Reference in Visual Studio and in COM or Browse TAB and browse to the following DLL "C:\Program Files\Common Files\Microsoft Shared\MODI\11.0\MDIVWCTL.DLL"
2. In Windows form first create a reference to the AxMODI Control e.g private AxMODI.AxMiDocView axMiDocView1;
3. In "InitializeComponent()" method add the following lines
1. this.axMiDocView1 = new AxMODI.AxMiDocView();
2. ((System.ComponentModel.ISupportInitialize)(this.axMiDocView1)).BeginInit();
3. this.axMiDocView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.axMiDocView1.Enabled = true;
this.axMiDocView1.Location = new System.Drawing.Point(0, 39);
this.axMiDocView1.Name = "axMiDocView1";
this.axMiDocView1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMiDocView1.OcxState")));
this.axMiDocView1.Size = new System.Drawing.Size(946, 348);
4. save and build and close the form
5. Open the forms designer you will have control available for usage in the designer
There are some good articles/Samples on code project just write MODI in the search of Codeproject.com and you will have good MODI .net samples available in the search results
I hope this solves your problem.
Thanks,
Wajhi Ghumman