This documentation is archived and is not being maintained.

OCR Method

Office 2003

Performs optical character recognition (OCR) on the specified document or image.

expression.OCR(LangId, OCROrientImage, OCRStraightenImage)

expression    Required. An expression that returns a Document object or an Image object.

LangId can be one of the following MiLANGUAGES constants.
miLANG_CHINESE_SIMPLIFIED (2052, &H804)
miLANG_CHINESE_TRADITIONAL (1028, &H404)
miLANG_CZECH (5)
miLANG_DANISH (6)
miLANG_DUTCH (19, &H13)
miLANG_ENGLISH (9)
miLANG_FINNISH (11)
miLANG_FRENCH (12)
miLANG_GERMAN (7)
miLANG_GREEK (8)
miLANG_HUNGARIAN (14)
miLANG_ITALIAN (16, &H10)
miLANG_JAPANESE (17, &H11)
miLANG_KOREAN (18, &H12)
miLANG_NORWEGIAN (20, &H14)
miLANG_POLISH (21, &H15)
miLANG_PORTUGUESE (22, &H16)
miLANG_RUSSIAN (25, &H19)
miLANG_SPANISH (10)
miLANG_SWEDISH (29, &H1D)
miLANG_SYSDEFAULT (2048, &H800)
miLANG_TURKISH (31, &H1F)

OCROrientImage    Optional Boolean. Specifies whether the OCR engine attempts to determine the orientation of the page. Default is true.

OCRStraightenImage    Optional Boolean. Specifies whether the OCR engine attempts to "de-skew" the page to correct for small angles of misalignment from the vertical. Default is true.

Remarks

The OCR engine always defaults to the user's regional settings for the LangID argument, unless you specify the language explicitly when calling the OCR method; it does not retain the previously used setting. In a mixed-language environment, it is a good practice to specify the LangID argument explicitly in every call to the OCR method.

Example

The following example performs OCR on all pages of the specified document.

Sub TestOCR()

  Dim miDoc As MODI.Document
  
  Set miDoc = New MODI.Document
  miDoc.Create "C:\document1.tif"
  
  Screen.MousePointer = vbHourglass
  miDoc.OCR
  Screen.MousePointer = vbDefault
  
  Set miDoc = Nothing

End Sub




Show: