- Preprocessing of scanned files or images
- Recognition with full restoration of document structure and formatting
- Documents or pages comparison
- Export to an external format
Scenario implementation
The code samples provided in this topic are Windows -specific.
Step 1. Loading ABBYY FineReader Engine
Step 1. Loading ABBYY FineReader Engine
To start your work with ABBYY FineReader Engine, you need to create the Engine object. The Engine object is the top object in the hierarchy of the ABBYY FineReader Engine objects and provides various global settings, some processing methods, and methods for creating the other objects.To create the Engine object, you can use the InitializeEngine function. See also other ways to load Engine object (Win).
C#
Step 2. Loading and preprocessing the files and images
Step 2. Loading and preprocessing the files and images
ABBYY FineReader Engine provides the FRDocument object which allows processing multi-page documents. Using this object allows you to preserve the logical organization of the document, retaining the original text and columns, fonts, styles, etc. Use the FRPage object if you want to compare pages.To load images of a single document and preprocess them, 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 file (use the AddImageFile, AddImageFileWithPassword, or AddImageFileWithPasswordCallback method of the FRDocument object).
C#
Step 3. Document recognition
Step 3. Document recognition
To recognize a document, we suggest that you use the analysis and recognition methods of the FRDocument object. This object provides a whole array of methods for document analysis, recognition, and synthesis. The most convenient method which provides document analysis, recognition, and synthesis all-in-one is the Process method. It also uses simultaneous processing features of multiprocessor and multicore systems in the most efficient manner. However, you can also perform consecutive preprocessing, analysis, recognition, and synthesis using Preprocess, Analyze, Recognize, and Synthesize methods.
You may set the recognition parameters for your documents by loading a suitable predefined profile (see Working with Profiles for more information).
You may set the recognition parameters for your documents by loading a suitable predefined profile (see Working with Profiles for more information).
C#
Step 4. Comparing the documents or pages
Step 4. Comparing the documents or pages
To compare the documents or pages with their copies:
- Make sure your ABBYY FineReader Engine license supports the Compare Documents module.
- Create a Comparator object with the help of the CreateComparator method of the Engine object.
- [optional] Use the ComparisonParams object to set up the properties to the values you need.
- Call the CompareDocuments method of the Comparator object to compare the original document with the copy. You will receive a ComparisonResult object containing the information about the detected changes.
C#
Step 5. Working with the detected changes
Step 5. Working with the detected changes
The ComparisonResult object contains the full list of the differences and provides the methods to get the differences for individual pages. You may access the changes from the original document and its copy with the GetChangesForReferencePage and GetChangesForUserPage methods. Use the ChangeLocation object to get the information about the location of the change and its RegionForPage property to get the region of the change on the specified page.
C#
Step 6. Exporting the comparison result
Step 6. Exporting the comparison result
To export the comparison result, call the Export method of the ComparisonResult object and pass the path to the file as an input parameter. The data may be saved to an XML or a DOCX with a Track Changes file.C#
Step 7. Unloading ABBYY FineReader Engine
Step 7. 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.
C#
Required resources
You can use the FREngineDistribution.csv file to automatically create a list of files required for your application to function. For processing with this scenario, select in the column 5 (RequiredByModule) the following values: Core Core.Resources Opening Opening, Processing Processing Processing.OCR Processing.OCR, Processing.ICR Processing.OCR.NaturalLanguages Processing.OCR.NaturalLanguages, Processing.ICR.NaturalLanguages Export Export, Processing If you modify the standard scenario, change the required modules accordingly. You also need to specify the interface languages, recognition languages and any additional features which your application uses (such as, e.g., Opening.PDF if you need to open PDF files, or Processing.OCR.CJK if you need to recognize texts in CJK languages). See Working with the FREngineDistribution.csv File for further details.Additional optimization for specific tasks
Below is the overview of the Help topics containing additional information regarding customization of settings at different processing stages:- Scanning - Windows Only
- Scanning
Description of the ABBYY FineReader Engine scenario for document scanning.
- Scanning
- Recognition
- Tuning Parameters of Preprocessing, Analysis, Recognition, and Synthesis
Customization of document processing using objects of analysis, recognition, and synthesis parameters. - PageProcessingParams Object
This object enables customization of analysis and recognition parameters. Using this object, you can indicate which image and text characteristics must be detected (inverted image, orientation, barcodes, recognition language, recognition error margin). - SynthesisParamsForPage Object
This object includes parameters responsible for restoration of a page formatting during synthesis. - SynthesisParamsForDocument Object
This object enables customization of the document synthesis: restoration of its structure and formatting. - MultiProcessingParams Object - Implemented for Linux and Windows
Simultaneous processing may be useful when processing a large number of images. In this case, the processing load will be spread over the processor cores during image opening and preprocessing, layout analysis, recognition, and export, which makes it possible to speed up processing.
Reading modes (simultaneous or consecutive) are set using the MultiProcessingMode property. The RecognitionProcessesCount property controls the number of processes that may be started.
- Tuning Parameters of Preprocessing, Analysis, Recognition, and Synthesis
