ImageGear for .NET
WriteDirectText(ImGearRecPage[],String) Method
See Also  Example Send Feedback
ImageGear21.Recognition Assembly > ImageGear.Recognition Namespace > ImGearRecOutputManager Class > WriteDirectText Method : WriteDirectText(ImGearRecPage[],String) Method




pages
Array of ImGearRecPage objects with the valid recognition data to be saved.
file
File to save recognition data to.

Glossary Item Box

Writes the recognition data of several pages to the file in the direct text format.

Syntax

 
Visual Basic
C#
Managed Extensions for C++
C++/CLI
 
 

Parameters

pages
Array of ImGearRecPage objects with the valid recognition data to be saved.
file
File to save recognition data to.

Remarks

Use DirectTextFormat to get or set the output format. If file parameter specifies an existing file name, the text outputs are appended.

Example

C#Copy Code
using (FileStream content = new FileStream("MULTIPAG.TIF", FileMode.Open))
{
    int numPages = ImGearFileFormats.GetPageCount(content, ImGearFormats.UNKNOWN);
    int i;
    ImGearRecPage[] pages = new ImGearRecPage[numPages];
    for (i = 0; i < numPages; i++)
    {
        ImGearPage igPage = ImGearFileFormats.LoadPage(content, i);
        pages[i] = igRecognition.ImportPage((ImGearRasterPage)igPage);
        pages[i].Image.Preprocess();
        pages[i].Recognize();
    }
    igRecognition.OutputManager.CodePage = "Windows ANSI";
    igRecognition.OutputManager.DirectTextFormat = ImGearRecDirectTextFormat.FormattedText;
    if(File.Exists("MULTIPAG.TXT"))
    {
        File.Delete("MULTIPAG.TXT");
    }
    igRecognition.OutputManager.WriteDirectText(pages, "MULTIPAG.TXT");

    for(i = 0; i < pages.Length; i ++)
    {
        pages[i].Dispose();
    }
}
Visual BasicCopy Code
Using content As New FileStream("MULTIPAG.TIF", FileMode.Open)
    Dim numPages As Integer = ImGearFileFormats.GetPageCount(content, ImGearFormats.UNKNOWN)
    Dim i As Integer
    Dim pages As ImGearRecPage() = New ImGearRecPage(numPages) {}
    i = 0
    While i < numPages
        Dim igPage As ImGearPage = ImGearFileFormats.LoadPage(content, i)
        pages(i) = igRecognition.ImportPage(DirectCast(igPage, ImGearRasterPage))
        pages(i).Image.Preprocess()
        pages(i).Recognize()
        System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
    End While
    igRecognition.OutputManager.CodePage = "Windows ANSI"
    igRecognition.OutputManager.DirectTextFormat = ImGearRecDirectTextFormat.FormattedText
    If File.Exists("MULTIPAG.TXT") Then
        File.Delete("MULTIPAG.TXT")
    End If
    igRecognition.OutputManager.WriteDirectText(pages, "MULTIPAG.TXT")

    i = 0
    While i < pages.Length
        pages(i).Dispose()
        System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
    End While
End Using

See Also

©2013. Accusoft Corporation. All Rights Reserved.