Office OCR Graphics recognizes Microsoft office Document Imaging

Source: Internet
Author: User

Using VB to invoke Office OCR components for graphic recognition

Original: http://sheng.iteye.com/blog/1330063

Office OCR Graphics recognizes Microsoft office Document Imaging

Option Explicit
' OCR recognition of images using the MS Office 2003/2007 OCR control
In VB, only less than 10 lines of code will be able to implement their own OCR word recognition software.
' 1. Add control, need to install office2003, no installation office2003 can copy related files from others, register Regsvr32.exe mdivwctl.dll,
' control is generally in this directory: C:\Program files\common Files\Microsoft shared\modi.0, only need the relevant several files on it, this folder all files about 21M.
' 2. Add this control with parts, engineering--Microsoft Office Document Imaging 11.0 Type Library
' 3. It is important to note that on Windows2003 server, if you use Office-brought identification software, you will get an error:
' "Error in performing OCR unsuccessful (text not found) on one or more pages, but it is normal for the test program to be written in VB.

' Main functions of OCR
Private Function ocrimagefile (ByVal strimagefilename as String) as Boolean
Dim Midoc as Object
' Initialize and load document
Set Midoc = CreateObject ("MODI. Document ") ' Create object
Midoc.create (strimagefilename) ' Loading picture file
Screen.MousePointer = Vbhourglass ' Set hourglass cursor
' Recognition
Err.Clear
Midoc.images (0). OCR 2052, True, True
Text1.Text = midoc.images (0). Layout.text
Ocrimagefile = True
Screen.MousePointer = Vbarrow ' Restore arrow cursor
End Function

Private Sub Cmdocr_click ()
Dim Bolp as Boolean
Dim strFileName as String
strFileName = "C:\test.tif"
Bolp = Ocrimagefile (strFileName)
End Sub

Office OCR Graphics Identify Microsoft office Document Imaging (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.