iTextSharp only reading header and footer content

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

iTextSharp only reading header and footer content

tthomps
I am using the following code to read a PDF.

 PdfReader reader = new PdfReader(currentFile);
                        string title = string.Empty;
                        try
                        {
                            title = reader.Info["Title"];
                        }
                        catch (Exception ex)
                        {
                            title = System.IO.Path.GetFileName(currentFile);
                        }

                        String output = string.Empty;

                        for (int i = 1; i <= reader.NumberOfPages; i++)
                            output += PdfTextExtractor.GetTextFromPage(reader, i, new SimpleTextExtractionStrategy());


The output of the code is the following...

"Blue Stream http://www.gazprom.com/about/production/projects/pipelines/active/blue...\n1 of 8 7/20/17, 12:24 PMBlue Stream http://www.gazprom.com/about/production/projects/pipelines/active/blue...\n2 of 8 7/20/17, 12:24 PMBlue Stream http://www.gazprom.com/about/production/projects/pipelines/active/blue...\n3 of 8 7/20/17, 12:24 PMBlue Stream http://www.gazprom.com/about/production/projects/pipelines/active/blue...\n4 of 8 7/20/17, 12:24 PMBlue Stream http://www.gazprom.com/about/production/projects/pipelines/active/blue...\n5 of 8 7/20/17, 12:24 PMBlue Stream http://www.gazprom.com/about/production/projects/pipelines/active/blue...\n6 of 8 7/20/17, 12:24 PMBlue Stream http://www.gazprom.com/about/production/projects/pipelines/active/blue...\n7 of 8 7/20/17, 12:24 PMBlue Stream http://www.gazprom.com/about/production/projects/pipelines/active/blue...\n8 of 8 7/20/17, 12:24 PM"


I have attached the PDF.  As you can see, it appears that only the headers and footers are being read.  what am I doing wrong?(U)_Blue_Stream_Gazprom.pdf