ImageGear .NET - Updated
WriteDirectText(ImGearRecPage[],String) Method
Example 




ImageGear24.Recognition Assembly > ImageGear.Recognition Namespace > ImGearRecOutputManager Class > WriteDirectText Method : WriteDirectText(ImGearRecPage[],String) Method
Array of ImGearRecPage objects with the valid recognition data to be saved.
File to save recognition data to.
Writes the recognition data of several pages to the file in the direct text format.
Syntax
'Declaration
 
Public Overloads Sub WriteDirectText( _
   ByVal pages() As ImGearRecPage, _
   ByVal file As String _
) 
'Usage
 
Dim instance As ImGearRecOutputManager
Dim pages() As ImGearRecPage
Dim file As String
 
instance.WriteDirectText(pages, file)
public void WriteDirectText( 
   ImGearRecPage[] pages,
   string file
)
public: void WriteDirectText( 
   ImGearRecPage*[]* pages,
   string* file
) 
public:
void WriteDirectText( 
   array<ImGearRecPage^>^ pages,
   String^ file
) 

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
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();
    }
}
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

Reference

ImGearRecOutputManager Class
ImGearRecOutputManager Members
Overload List