using Tesseract;

namespace TessaractTest
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void btnLoad_Click(object sender, EventArgs e)
		{
			OpenFileDialog dlg = new OpenFileDialog();
			if (dlg.ShowDialog() != DialogResult.OK)
				return;

			string filePath = dlg.FileName;
			pbxMain.Load(filePath);
			pbxMain.SizeMode = PictureBoxSizeMode.Zoom;

			Pix pix = Pix.LoadFromFile(filePath);
			TesseractEngine ocr = new TesseractEngine("./tessdata", "kor", EngineMode.Default);
			Page page = ocr.Process(pix);

			tbxMain.Text = page.GetText();
		}
	}
}