- Image opening
- Recognition
- Verification
- Export
Step 1. Adding Visual Components to the form of your application
Step 1. Adding Visual Components to the form of your application
Visual Studio enables you to insert ActiveX controls into your dialog box. You can add Visual Components to the Toolbox window (the Toolbox is available from the View menu) and work with them:
- On the Tools menu, click Choose Toolbox Items (or Add/Remove Toolbox Items).
- In the dialog box that opens, click the COM Components tab and select the ABBYY DocumentViewer, ABBYY ImageViewer, ABBYY ZoomViewer, ABBYY TextEditor, and ABBYY TextValidator components.
- Click OK. Icons for the selected items are now available in the Toolbox. You can drag and drop each Visual Component icon onto a design view surface. This action also adds the fundamental code to create an instance of the Visual Component in the active project file.
- After you have added the Visual Component to a form, you can specify its properties available in Visual Studio. For example, the SettingsPath property of each component should be specified at design time.
The Visual Studio designer does not support 64-bit ActiveX controls. Due to this fact, you cannot add 64-bit Visual Components to a Windows Form application. This is a known behavior; similar issues are described for Microsoft ActiveX controls, e.g., in http://support.microsoft.com/kb/980533/en-us. To provide a workaround for this issue, FineReader Engine installs both 32-bit and 64-bit Visual Components if you select Visual Components for developer installation on a 64-bit system. In this case, in Visual Studio designer, you can work with the 32-bit version of components. A 64-bit application that uses Visual Components does not need 32-bit Visual Components installed.
Step 2. Synchronizing Visual Components
Step 2. Synchronizing Visual Components
The Component Synchronizer component allows you to synchronize Visual Components in the application. That means that all viewing and editing operations will be processed synchronously in all connected components. To synchronize Visual Components:
- On form loading, create a new ComponentSynchronizer object.
- Use the DocumentViewer, ImageViewer, ZoomViewer, TextEditor, TextValidator properties of the ComponentSynchronizer object to connect the components to the synchronizer.
C#
Step 3. Loading ABBYY FineReader Engine
Step 3. Loading ABBYY FineReader Engine
To start working with ABBYY FineReader Engine, you need to create the Engine object. To create the Engine object, you can use the InitializeEngine exported function. See also other ways to load Engine object. You may load the Engine object during image loading or form initialization.
C#
Step 4. Image opening
Step 4. Image opening
To display the image in the Visual Components, you should open it. You may implement the following procedure for image opening:
- To load images of a single document, you should create the FRDocument object and add images to it. You may do one of the following:
- Create the FRDocument object using the CreateFRDocumentFromImage method of the Engine object. This method creates the FRDocument object and loads images from the specified file.
- Create the FRDocument object with the help of the CreateFRDocument method of the Engine object, then add images to the created FRDocument object from the file (use the AddImageFile, AddImageFileWithPassword, or AddImageFileWithPasswordCallback method of the FRDocument object).
- Attach the document to Component Synchronizer using the Document property of the ComponentSynchronizer object.
C#
Step 5. Recognizing documents
Step 5. Recognizing documents
Recognition of an image in Visual Components can be called either using the commands, available in components or using FineReader Engine API (see, for example, the Process method of the FRDocument object).You may implement the following procedure for recognition:
- Recognize the document using the methods of the FRDocument object.
- The document has been changed not through Visual Components GUI, therefore you need to report the changes to Visual Components. Use the Update method of the FRPage object for each page in the document.
C#
Step 6. Verifying recognition results
Step 6. Verifying recognition results
The recognized data can be verified using the Text Validator component. It provides the user interface which allows you to check whether a character has been recognized correctly and correct it if necessary.You may implement the following procedure for verification:
- Add the Text Validator component to the current form or create a new form for it.
- Attach the Text Validator component to Component Synchronizer. Use the TextValidator property of the ComponentSynchronizer object.
- Start the verification process using the Spell method of the TextValidator object.
C#
Step 7. Exporting results
Step 7. Exporting results
The recognized document can be saved either by using commands available in the Document Viewer, or using FineReader Engine API.For example, use the Export method of the FRDocument object by assigning the FileExportFormatEnum constant as one of the parameters. After you have finished your work with the FRDocument object, release all the resources that were used by this object. Use the IFRDocument::Close method. The procedure can handle the “on click” event for a button that calls export.
C#
Step 8. Unloading ABBYY FineReader Engine
Step 8. Unloading ABBYY FineReader Engine
After finishing your work with ABBYY FineReader Engine, you need to unload the Engine object. To do this, use the DeinitializeEngine exported function.The procedure can handle the “on click” event for a button that closes the application window.
We recommend that you release Component Synchronizer before Engine deinitialization.
