Handling the Results of the Recognition Process

Once the OCR document has been recognized, the results can be saved either to a file or to memory. To save the results to a file, call the SaveDocument with the desired file name specified in the bstrFileName parameter. The Recognize method saves the recognition results to the file specified in the RecognitionDataFileName property. When the SaveDocument method is called, the recognition results are read from the file specified in the RecognitionDataFileName property and converted to the final output file specified in the bstrFileName parameter of the SaveDocument method.

To save the recognition results to memory instead of a file, set the EnableSaveResultsToMemory property to TRUE and call the SaveResultsToMemory method. The SaveResultsToMemory method updates the MemoryRecognitionResult property with the actual recognition results and updates the MemoryRecognitionResultSize property with the size of the recognition results saved.

Recognition results options determine how the recognition results are saved, and exactly what is output. To get the current options used by the OCR engine to save the recognition results, call the GetRecognitionResultOptions method. This method updates the ResultOptions property with the current settings. The ResultOptions property itself is read only, but the ILTResultOptions properties accessed through this property can be set. Set these properties to the desired new values and set the recognition result options for the OCR engine by calling the SetRecognitionResultOptions method.

The recognition results are saved to an output document, which can be saved to a file or to memory. The output document will have a certain format type, as determined by the Format property. The amount of formatting saved to the output document is determined by the FormatLevel property. The other properties accessed through this ILTResultOptions object contain information on the document characteristics that are exported to the output document, paragraph characteristics that are exported to the output document, character characteristics that are exported to the output document, and mark characteristics that are exported to the output document.

The DocumentOptions property contains the document characteristics that are output to the output document. This property is a pointer to an ILTDocumentOptions object. While the DocumentOptions property is read only, the ILTDocumentOptions properties accessed through it can be set. For more information on the ILTDocumentOptions properties accessed through the DocumentOptions property of the ResultOptions property, refer to Using the Document Options.

The ParagraphOptions property contains the paragraph characteristics that are output to the output document. This property is a pointer to an ILTParagraphOptions object. While the ParagraphOptions property is read only, the ILTParagraphOptions properties accessed through it can be set. For more information on the ILTParagraphOptions properties accessed through the ParagraphOptions property of the ResultOptions property, refer to Using the Paragraph Options.

The CharacterOptions property contains the character characteristics that are output to the output document. This property is a pointer to an ILTCharacterOptions object. While the CharacterOptions property is read only, the ILTCharacterOptions properties accessed through it can be set. For more information on the ILTCharacterOptions properties accessed through the CharacterOptions property of the ResultOptions property, refer to Using the Character Options.

The MarkOptions property contains the mark characteristics that are output to the output document. This property is a pointer to an ILTMarkOptions object. While the MarkOptions property is read only, the ILTMarkOptions properties accessed through it can be set. For more information on the ILTMarkOptions properties accessed through the MarkOptions property of the ResultOptions property, refer to Using the Mark Options.

When saving recognition results to a file, you can use the GetOutputFileFormats method to enumerate all available output file formats supported by the OCR engine. For each file format enumerated, an EnumOutputFileFormats event is generated. Within this event, call the GetFileFormatInfo method to update the FileFormatInfo property with information on that file format.

The FileFormatInfo property is a pointer to an ILTFileFormatInfo object that accesses properties that are updated with the file format information. This information includes the name of the output text format (FormatName property), the default extension for the document (ExtName property), the type of document to output (Type property) and the name of the converter DLL (DLLName property). These ILTFileFormatInfo properties are read only, so they can only be used to get information about a file format. They cannot be used to change the file format information.