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