ImageGear22.Recognition Assembly > ImageGear.Recognition Namespace > ImGearRecOutputManager Class > WriteDirectText Method : WriteDirectText(ImGearRecPage[],String) Method |
'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 )
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