Layout Object


Returns the results of optical character recognition (OCR) on an image.

Using the Layout Object

The Layout object represents the results of OCR on the specified image. Use the Layout accessor property of the Image object to return a Layout object and gain access to the recognized text itself (Text and Words) and summary information about the OCR results (NumWords, NumChars, NumFonts and Language).

The Layout property returns Nothing when OCR has not yet been performed on the page.


The following example returns OCR layout information for the first page in a document.

Sub TestLayout()
  Dim miDoc As MODI.Document
  Dim miLayout As MODI.Layout
  Dim strLayoutInfo As String
  ' Load an existing TIFF file.
  Set miDoc = New MODI.Document
  miDoc.Create "C:\document1.tif"
  ' Perform OCR.
  ' Retrieve and summarize the OCR results.
  Set miLayout = miDoc.Images(0).Layout
  strLayoutInfo = _
   "Language: " & miLayout.Language & vbCrLf & _
    "Number of characters: " & miLayout.NumChars & vbCrLf & _
    "Number of fonts: " & miLayout.NumFonts & vbCrLf & _
    "Number of words: " & miLayout.NumWords & vbCrLf & _
    "Beginning of text: " & Left(miLayout.Text, 50) & vbCrLf & _
    "First word of text: " & miLayout.Words(0).Text
  MsgBox strLayoutInfo, vbInformation + vbOKOnly, _
    "Layout Information"
  Set miLayout = Nothing
  Set miDoc = Nothing

End Sub

Properties | Language Property | NumChars Property | NumFonts Property | NumWords Property | Text Property | Words Property

Parent Objects

Child Objects | Words Object