Example #1
0
        public void ExtractObstacleList()
        {
            // Setting this to true will add the required value
            using (PdfReader reader = new PdfReader(FileSourcePDF))
            {
                // If this is true, then add the page to
                // Table List
                bool add = false;
                // Iterate through all the pages
                for (int i = 1; i <= reader.NumberOfPages; i++)
                {
                    TableExtractionStrategy strategy = new TableExtractionStrategy
                    {
                        // Modify this value if Required
                        NextLineLookAheadDepth = 350,
                        NextCharacterThreshold = 1.0F
                    };

                    // Extract the Page Data According to the pre-decided Strategy
                    string page = PdfTextExtractor.GetTextFromPage(reader, i, strategy);
                    // As this contains AD 2.10 in Range
                    // Start Adding
                    if (!add /*If add is true, it's already found*/ && page.Contains("AD 2.10"))
                    {
                        add = true;
                    }
                    // If Add is Enabled now
                    // It means we should insert
                    if (add)
                    {
                        // Get A Data Set of All Obstacles from the Given PDF
                        Obstacles.AddRange(strategy.GetTable());
                    }
                    //As we were Supposed to Extract only
                    // AD2.10 and not anything else
                    // Our work here is done
                    // This is Because
                    // AD2.11 Comes after AD2.10
                    if (add /*If add is false, no need to find this*/ && page.Contains("AD 2.11"))
                    {
                        break;
                    }
                }
            }
        }
        public void ExtractObstacleList()
        {
            // Setting this to true will add the required value
            using (PdfReader reader = new PdfReader(FileSourcePDF))
            {
                // Iterate through all the pages
                for (int i = 1; i <= reader.NumberOfPages; i++)
                {
                    TableExtractionStrategy strategy = new TableExtractionStrategy
                    {
                        // Modify this value if Required
                        NextLineLookAheadDepth = 150,
                        NextCharacterThreshold = 1.0F
                    };

                    // Extract the Page Data According to the pre-decided Strategy
                    string page = PdfTextExtractor.GetTextFromPage(reader, i, strategy);
                    // Get A Data Set of All Obstacles from the Given PDF
                    ICAOCodes.AddRange(strategy.GetTable());
                }
            }
        }