Office Document Imaging 2003 VBA Language Reference
Using the Microsoft Office Document Imaging 2003 Viewer Control

The Microsoft® Office Document Imaging Library 2003 (MODI) object model makes it possible to develop custom applications for managing document images (such as scanned and faxed documents) and the recognizable text that they contain. The MODI components include the MODI Viewer Control, an ActiveX® control that you can use to display MODI documents.

Important  The MODI programmability features described in this document are available only in Microsoft Office Document Imaging 2003. The Microsoft Office XP version of document imaging does not include a programmable object model.

Using the MODI Viewer Control in a Development Project

To make the viewer control available in the Toolbox, select Microsoft Office Document Imaging 11.0 Type Library in the Components dialog box in your development environment. This selection also sets a reference in your project to the Microsoft Office Document Imaging 11.0 Type Library and makes the entire MODI object model available for automation. The viewer control corresponds to the MiDocView object in the MODI object model.

See Using the Microsoft Office Document Imaging 2003 Object Model for additional information.

Overview of the MODI Viewer Control

You can use the viewer control to display and scroll through MODI documents. You can manipulate the scaling of the document in the window, scroll the image programmatically, retrieve the user's selection as text or as an image, and return information about the contents of the viewer window and its coordinates.

MiDocView (viewer control) Properties, Methods, and Events

Properties  
ActionStateThe allowable actions. For example, "pan" and "select".
DocumentThe displayed document.
DocViewModeA setting that determines how pages are displayed.
FileNameThe file name of the document, if opened from a file.
FitModeA value that determines how to fit a page into the viewer window.
ImageSelectionThe user's selection returned as an image.
LayerVisibleThe visible layer of the document.
NumPagesThe number of pages in the document.
PageNumThe currently displayed page.
TextSelectionThe user's selection as text.
Methods  
ClientToDocumentTranslates viewer coordinates to document coordinates.
ClientToImageTranslates viewer coordinates to page coordinates.
DocumentToClientTranslates document to viewer coordinates.
GetScaleReturns the scaling factor that is in use.
GetVisibleRectReturns the coordinates of the visible rectangle.
ImageToClientTranslates page coordinates to viewer coordinates.
MoveRectIntoViewMoves the specified rectangle into view.
MoveSelectionToViewMoves the user's selection into view.
SelectAllSelects everything on the page.
SetScaleSets the scaling factor to be used.
Events  
CurPageNumChangedOccurs when a different page is displayed.
FitmodeChangedOccurs when the FitMode property has changed.
PageChanged[Reserved for future use.]
PageCountChangedOccurs when the document's page count has changed.
ScaleChangedOccurs when the scaling factor has changed.
SelectionChangedOccurs when the user has changed the selection.
VisibleRectChangedOccurs when the visible rectangle has changed.

Loading a Document into the Viewer Control

You can load a document into the viewer control by using either of the following properties:

  • Set the control's FileName property to the name of an existing MDI or TIF file.
  • Set the control's Document property to a document that is already loaded in memory. (In this case, the Filename property remains empty.)

Working with the User's Selection

You can retrieve the user's selection in the viewer control window as text through the TextSelection property (which returns an IMiSelectableItem object) or as an image through the ImageSelection property (which returns an IMiSelectableImage object).

IMiSelectableItem (text selection) Properties, Methods, and Events

Properties  
TextThe recognized text in the selection.
WordsA collection of the words in the recognized text.
Methods  
CopyToClipboardCopies the selection as text to the clipboard.
GetSelectRectsReturns a collection of bounding rectangles.

IMiSelectableImage (image selection) Properties, Methods, and Events

Methods  
CopyToClipboardCopies the selection as an image to the clipboard.
ExportToPictureReturns the image selection as an IPictureDisp.
GetBoundingRectReturns the bounding rectangle.

Limitations of the MODI Viewer Control

MODI automation provides powerful document management and optical character recognition (OCR) features; however, it does not automate the document scanning process itself or support image annotation.



Page view tracker