Aspose.OCR.Examples.CSharp.FormattingAndManipulatingOCR.UsingNotifierFactory.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:UsingNotifierFactory
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OCR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Set the Image property by loading the image from file path location or an instance of MemoryStream 
            ocrEngine.Image = ImageStream.FromFile(dataDir + "answers.jpg");

            // Get an instance of WordNotifier, Write a delegate to handle the Elapsed event and Display the recognized text on screen
            INotifier processorBlock = NotifierFactory.BlockNotifier();
            processorBlock.Elapsed += delegate
            {
                Console.WriteLine(processorBlock.Text);                
            };

            // Add the word processor to the OcrEngine and Process the image
            ocrEngine.AddNotifier(processorBlock);
            ocrEngine.Process();
            // ExEnd:UsingNotifierFactory            
        }
    }
UsingNotifierFactory