Exemple #1
0
        private void btnStartParser_Click(object sender, RoutedEventArgs e)
        {
            string pdfPath = this.txtPDFPath.Text;

            if (!string.IsNullOrEmpty(pdfPath))
            {
                DirectoryInfo   dirInfos  = new DirectoryInfo(pdfPath);
                List <FileInfo> itemfiles = new List <FileInfo>();

                DateTime readFileTime = DateTime.Now;

                GetFiles(dirInfos, ref itemfiles);

                if (itemfiles != null && itemfiles.Count > 0)
                {
                    foreach (var dirInfo in itemfiles)
                    {
                        var result = PDFParser.Parser(dirInfo.FullName, TableContainType.CSV);
                        if (result != null && !string.IsNullOrWhiteSpace(result.Text))
                        {
                            File.WriteAllText(System.IO.Path.Combine(Environment.CurrentDirectory, "result/" + dirInfo.Name.Replace(".pdf", "")) + ".txt", result.Text);
                        }
                    }
                }
            }
        }