Exemple #1
0
        private void StartUpOcrEngine()
        {
            try
            {
                Properties.Settings settings = new Properties.Settings();
                string engineType            = settings.OcrEngineType;

                ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);
                ocrEngine.Startup(null, null, null, null);

                if (ocrEngine.SettingManager.IsSettingNameSupported("Recognition.RecognitionModuleTradeoff"))
                {
                    ocrEngine.SettingManager.SetEnumValue("Recognition.RecognitionModuleTradeoff", "Accurate");
                }
            }
            catch (Exception exp)
            {
                Messager.ShowError(this, exp);
                throw;
            }
        }
Exemple #2
0
        private void ShutDownEngines()
        {
            if (ocrEngine != null && ocrEngine.IsStarted)
            {
                Properties.Settings settings = new Properties.Settings();
                settings.OcrEngineType = ocrEngine.EngineType.ToString();
                settings.Save();

                ocrEngine.Shutdown();
                ocrEngine.Dispose();
            }

            if (twainSession != null)
            {
                try
                {
                    twainSession.Shutdown();
                }
                catch
                { }
            }
        }