Exemple #1
0
        public void TestMethod1_itext7()
        {
            string file     = "data\\CS15.page6.pdf";
            string folder   = Util.GetProjectDir2();
            string fullpath = System.IO.Path.Combine(folder, file);

            byte[] contents = System.IO.File.ReadAllBytes(fullpath);
            Contracts.IExtractDocument extractor = new SampleLib.itext7.Class1();
            var pages = extractor.GetBlocks(contents);

            Trace.WriteLine($"Text={pages[0].Blocks[0]}");
        }
Exemple #2
0
        public void Fire_Both_itext5_And_itext7_Compare4May2017()
        {
            string file     = "data\\CS15.page6.pdf";
            string folder   = Util.GetProjectDir2();
            string fullpath = System.IO.Path.Combine(folder, file);

            byte[] contents = System.IO.File.ReadAllBytes(fullpath);
            ///
            /// Invoke itext7
            ///
            Contracts.IExtractDocument extractor7 = new SampleLib.itext7.Class1();
            var pages7 = extractor7.GetBlocks(contents);

            Trace.WriteLine($"itext7    Text={pages7[0].Blocks[0]}");
            ///
            /// Invoke itext5
            ///
            Contracts.IExtractDocument extractor5 = new SampleLib.itext5.Class1();
            var pages5 = extractor5.GetBlocks(contents);

            Trace.WriteLine($"itextsharp5   Text={pages5[0].Blocks[0]}");
        }
Exemple #3
0
        public void Fire_Both_itext5_And_itext7_Compare_2ConsecutiveLines()
        {
            string file     = "data\\CS15.page6.pdf";
            string folder   = Util.GetProjectDir2();
            string fullpath = System.IO.Path.Combine(folder, file);

            byte[] contents = System.IO.File.ReadAllBytes(fullpath);
            ///
            /// Invoke itext7
            ///
            Contracts.IExtractDocument extractor7 = new SampleLib.itext7.Class1();
            var pagesV7   = extractor7.GetBlocks(contents);
            var blockV7_C = pagesV7[0].Blocks[40];
            var blockV7_T = pagesV7[0].Blocks[231];

            Trace.WriteLine($"Results obtained using itext7");
            Trace.WriteLine($"itext7    Text={blockV7_C}");
            Trace.WriteLine($"itext7    Text={blockV7_T}");
            double gapBetweenRowsV7 = blockV7_C.Bottom - blockV7_T.Top;

            Trace.WriteLine($"Gap between 2 rows={gapBetweenRowsV7}");
            Trace.WriteLine("-------------------------------------------");
            ///
            /// Invoke itext5
            ///
            Contracts.IExtractDocument extractor5 = new SampleLib.itext5.Class1();
            var pagesV5   = extractor5.GetBlocks(contents);
            var blockV5_C = pagesV5[0].Blocks[40];
            var blockV5_T = pagesV5[0].Blocks[231];

            Trace.WriteLine($"Results obtained using itext5");
            Trace.WriteLine($"itext5    Text={blockV5_C}");
            Trace.WriteLine($"itext5    Text={blockV5_T}");
            double gapBetweenRowsV5 = blockV5_C.Bottom - blockV5_T.Top;

            Trace.WriteLine($"Gap between 2 rows={gapBetweenRowsV5}");
            Trace.WriteLine("-------------------------------------------");
        }