Exemplo n.º 1
0
        private void TheWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var b = new Bitmap("ignat.jpg");


            var o   = new OneNoteOCR();
            var arr = o.OcrTexts("ignat.jpg");


            using (Graphics gr = Graphics.FromImage(b))
            {
                gr.PageUnit      = GraphicsUnit.Point;
                gr.SmoothingMode = SmoothingMode.AntiAlias;

                gr.DrawRectangles(Pens.Red, arr.Select(it => it.Rect).ToArray());
            }
            //var src = new BitmapImage();
            //src.BeginInit();
            //src.CacheOption = BitmapCacheOption.OnLoad;
            //src.UriSource = new Uri("ignat.jpg", UriKind.Relative);
            //src.EndInit();
            var src = FromImage(b);

            //var i = new Image();
            //i.Stretch = Stretch.Fill;
            image.Source = src;
            //image.Stretch= Stretch.UniformToFill;


            //int q = src.PixelHeight;        // Image loads here
            //Sp.Children.Add(i);
        }
        public override void RunCommand(object sender)
        {
            var engine    = (AutomationEngineInstance)sender;
            var vFilePath = v_FilePath.ConvertUserVariableToString(engine);

            OneNoteOCR ocrEngine = new OneNoteOCR();

            OCRText[] ocrTextArray = ocrEngine.OcrTexts(vFilePath).ToArray();

            string endResult = "";

            foreach (var text in ocrTextArray)
            {
                endResult += text.Text;
            }

            endResult.StoreInUserVariable(engine, v_OutputUserVariableName);
        }
        public async override Task RunCommand(object sender)
        {
            var engine    = (IAutomationEngineInstance)sender;
            var vFilePath = (string)await v_FilePath.EvaluateCode(engine);

            OneNoteOCR ocrEngine = new OneNoteOCR();

            OCRText[] ocrTextArray = ocrEngine.OcrTexts(vFilePath).ToArray();

            string endResult = "";

            foreach (var text in ocrTextArray)
            {
                endResult += text.Text;
            }

            endResult.SetVariableValue(engine, v_OutputUserVariableName);
        }