read the data from tiff file using MODI and OCR in VBA

divya_agarwal

Board Regular
Joined
Nov 24, 2008
Messages
51
Hi,
Can any body correct me to read the data from tiff image by using MODI and OCR .
Plz check the code.
Dim doc1 As MODI.Document
Dim inputFile As String
Dim strRecText As String
Dim imageCounter As Integer

inputFile = Application.GetOpenFilename
'(Title:="Please choose a file to import", _
'FileFilter:="Image Files *.tif (*.tif)")
strRecText = ""
Set doc1 = New MODI.Document
doc1.Create (inputFile)
doc1.OCR ' this will ocr all pages of a multi-page tiff file
doc1.Save ' this will save the deskewed reoriented images, and the OCR text, back to the inputFile
For imageCounter = 0 To (doc1.Images.Count - 1) ' work your way through each page of results
strRecText = strRecText & doc1.Images(imageCounter).Layout.Text ' this puts the ocr results into a string
Next

File.AppendAllText("C:\test\testmodi.txt", strRecText) ' write the OCR file out to disk
doc1.Close
doc1 = Nothing



that program is showing error in the colored line.

Regards,
Divya Agarwal


 
one more thing Blade hunter

In the new OCRText File it displays only few data and also data is not proper. Some thing is matching some thing are not matching.

Data is in TestModi:

Dtvrha () I
@7 5. (tx,&
?NJØ%J eootl
.328
U Sock No. $.No.
CR CHARAN SINGH UNWERSITY, MEERUT
(Formedy Meerut UnNer&ty, Meerut)
Provisional Cenficate
&nificd that £Z.M!M
S4nii3aughter of Sn
4)rf7-,k oc
w Lxwr azowY’ c-”
vi:h Roi No p... 7EJLL.fl?fl No. M,.d p
c JhD (OL C
,C tCi72r
.cina Jw5 dcci red sccccssftd in . .. ..i..ijN;. Division, T’hc dezrcc
4:W he award Ca .h/.er next Con xs)or.
Dated ‘‘‘ AssttiDy. Registrar (Conf.)
for Registrar
J
SubUtc.
No! 9tji’54sQ’
29
ft—f


 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I would have to put that down to the tiff having data that can't be recognized. I have never used OCR before so I am not sure how you could improve the recognition unfortunately.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,016
Members
448,936
Latest member
almerpogi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top