Beispiel #1
0
        private void ResultOutput(int type, string path, Image img = null)
        {
            if (Setting.IsOffline)
            {
                RichTextBoxValue.Text = OCROffline.OCROffile(path, img);
            }
            else
            {
                // 文字识别
                if (type == 1)
                {
                    if (img == null)
                    {
                        OCRHelper.BaiduBasic(path);
                    }
                    else
                    {
                        OCRHelper.BaiduBasic("", img);
                    }

                    // 段落
                    switch (Setting.Paragraph)
                    {
                    case 1:
                        RichTextBoxValue.Text = OCRHelper.typeset_txt.Trim();
                        break;

                    case 2:
                        RichTextBoxValue.Text = OCRHelper.split_txt.Trim();
                        break;

                    case 3:
                        RichTextBoxValue.Text = OCRHelper.typeset_txt.Trim().Replace("\n", "").Replace("\r", "");
                        break;
                    }
                }
                else // 表格识别
                {
                    if (img == null)
                    {
                        RichTextBoxValue.Text = OCRHelper.BaiduForm(path);
                    }
                    else
                    {
                        RichTextBoxValue.Text = OCRHelper.BaiduForm("", img);
                    }
                }
            }
            // 识别后自动复制
            if (Setting.TextCopy)
            {
                ButtonCopy_Click(null, null);
            }
        }