Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (txtTempPath.Text.Equals("") || txtPDFPath.Text.Equals("") || txtTrial.Text.Equals(""))
            {
                string msg = "";
                msg = msg + (txtTempPath.Text.Equals("")?"Data Template":"") + "\n";
                msg = msg + (txtPDFPath.Text.Equals("") ? "PDF File" : "") + "\n";
                msg = msg + (txtTrial.Text.Equals("") ? "Itext Key License" : "") + "\n";

                MessageBox.Show("No Selected \n" + msg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);

                return;
            }
            // LicenseKey.LoadLicenseFile(@"C:\Users\Arn-Windows\Documents\Visual Studio 2015\Projects\itextkey1590057483769_0.xml");
            LicenseKey.LoadLicenseFile(txtTrial.Text);
            Template template = Pdf2DataExtractor.ParseTemplateFromPDF(txtTempPath.Text);

            Pdf2DataExtractor extractor = new Pdf2DataExtractor(template);
            ParsingResult     result    = extractor.Recognize(txtPDFPath.Text);

            lblLastName.Text      = result.GetResults("LastName").FirstOrDefault().ToString();
            lblApplicationNo.Text = result.GetResults("AppliccationNo").FirstOrDefault().ToString();
            lblFirstName.Text     = result.GetResults("FirstName").FirstOrDefault().ToString();

            // lblAddress.Text= result.GetResults("Address").FirstOrDefault().ToString();
            foreach (ResultElement item in result.GetResults("Address"))
            {
                lblAddress.Text = lblAddress.Text + item.ToString() + "\n";
            }

            //MessageBox.Show("Application NO.= "+ result.GetResults("AppliccationNo").FirstOrDefault());

            MessageBox.Show("Data has been Loaded!", "Sucess");
        }