Example #1
0
        public static List <List <TextBlock> > ExtractBlockList(string filename)
        {
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException("File: [" + filename + "] does not exist.");
            }
            var strategy = new TextExtractionStrategyForBlockList();

            using (var pdfReader = new PdfReader(filename))
            {
                for (var page = 1; page <= pdfReader.NumberOfPages; page++)
                {
                    PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy);
                }
            }

            return(strategy.BlockList);
        }
Example #2
0
        public static List<List<TextBlock>> ExtractBlockList(string filename)
        {
            if (!File.Exists(filename)) throw new FileNotFoundException("File: [" + filename + "] does not exist.");
            var strategy = new TextExtractionStrategyForBlockList();

            using (var pdfReader = new PdfReader(filename))
            {
                for (var page = 1; page <= pdfReader.NumberOfPages; page++)
                {
                    PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy);
                }
            }

            return strategy.BlockList;
        }