Ejemplo n.º 1
0
        public static void ExtractWithITextSharpTest()
        {
            PdfReader reader = new PdfReader(@"../../../Bank2QifTests/data/wyciag1.pdf");

            IEnumerable <string> lines = new List <string>();

            for (int i = 1; i <= reader.NumberOfPages; i++)
            {
                string input = PdfTextExtractor.GetTextFromPage(reader, i, new LocationTextExtractionStrategy());
                lines = lines.Concat(TrimStrings(input, i == 1));
            }


            //foreach (var line in lines)
            //{
            //    Console.WriteLine(line);
            //}
            Sprache parser = new Sprache();

            if (!OpNames.Any(s => lines.ElementAt(0).Contains(s)))
            {
                throw new ApplicationException("Bad first line");
            }
            var current = new List <string>();// { lines.ElementAt(0) };
            var entries = new List <QifEntry>();

            foreach (var line in lines)
            {
                // if it is a line starting with correct operation name and if it is a subsequent operation line
                if (OpNames.Any(s => line.Contains(s)) && current.Count > 1)
                {
                    var total = current.Aggregate((s1, s2) => string.Format("{0}{1}{2}", s1, Environment.NewLine, s2));
                    entries.Add(parser.ParseSingleToQif(total));
                    current.Clear();
                }
                current.Add(line);
            }
            var lastOne = current.Aggregate((s1, s2) => string.Format("{0}{1}{2}", s1, Environment.NewLine, s2));

            entries.Add(parser.ParseSingleToQif(lastOne));

            foreach (var e in entries)
            {
                Console.WriteLine("==========================");
                Console.WriteLine(e);
                Console.WriteLine("==========================");
            }
        }
Ejemplo n.º 2
0
 private static void SpracheCase()
 {
     Sprache.Start();
 }
Ejemplo n.º 3
0
        public static void Start()
        {
            var s = new Sprache();

            s.Sprache1();
        }