ImageGear for .NET
Exporting to a Formatted Output Document

The ImageGear Recognition API allows saving recognized data to a number of document formats, such as RTF, Microsoft Office Word, or Excel.

This API group requires ImGearRecLicenseFeature.FormattedOutput to be enabled.

After having successfully recognized the image (or a series of images), create an ImGearRecDocument Class object for accumulating recognized pages and writing them to the final output document. Use ImGearRecDocument.Create static method to create an empty ImGearRecDocument object. Then, use ImGearRecDocument.InsertPage to insert recognized pages to the document. ImGearRecDocument class also allows you to remove, update, or reorder pages. You can also save ImGearRecDocument object into an intermediate file, preserving all of the recognized data, and reopen it later. Use ImGearRecDocument.Save Method and ImGearRecDocument.Open static method, correspondingly.

When a page has been added to the document, the document gets ownership of the recognized data, and the page object becomes invalid. Use ImGearRecPage.IsValid property to check if the page is valid. If you need to re-recognize the image that has been added to a document, reimport it from ImGearPage. You can then recognize it and update the corresponding page in the document, using ImGearRecDocument.UpdatePage.

When all document pages have been recognized, you can output the final document using ImGearRecOutputManager.WriteDocument. The Code Page, format of the final output document, and the level of format retention should be specified beforehand, using the CodePage Property, Format Property, and Level Property. The full list of supported output formats is given in the topic Output Text Format List.

To check whether a requested output format is available in the current Recognition API's configuration, use the Formats Property to examine the list of available output formats.

Enumerating the Available Output Text File Formats

C#
Copy Code
string formatList = "";
for (int i = 0; i < igRecognition.OutputManager.Formats.Count; i++)
{
     ImGearRecOutputFormat igRecOutputFormat = igRecognition.OutputManager.Formats[i];
     formatList += "Text Format: " + igRecOutputFormat.Name + Environment.NewLine;
     formatList += "Extension: " + igRecOutputFormat.DefaultFileExtension + Environment.NewLine;
}
System.Console.WriteLine(formatList);
VB .NET
Copy Code
Dim formatList As String = ""
Dim i As Integer = 0
While i < igRecognition.OutputManager.Formats.Count
      Dim igRecOutputFormat As ImGearRecOutputFormat = igRecognition.OutputManager.Formats(i)
      formatList += "Text Format: " + igRecOutputFormat.Name + Environment.NewLine
      formatList += "Extension: " + igRecOutputFormat.DefaultFileExtension + Environment.NewLine
      System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
End While
System.Console.WriteLine(formatList)

In some cases the application may need to access the recognized information on a per-character basis. For this structured data output, you can use the GetLetters Method, which provides access to the recognized output of the Recognize Method.

The GetLetters Method can only be called immediately after recognition, so the Recognize Method must be used with one page being processed at a time.

 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback