I am using iTextSharp PDFReader to read a pdf file that has 18 pages but every time I increment the page number, it starts from the beginning of the pdf instead of reading just that particular page. If I set "x" to the pdfReader.NumberOfPages value, it only reads the last page. I would like to read each page individually and add the data to my list of string s. I am also going through a folder, reading each pdf file, but I am testing with just one at first.
List<string> s = new List<string>();
while (z < filePaths.Count())
{
PdfReader pdfReader = new PdfReader(filePaths[z]);
ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
for (int x = 1; x <= pdfReader.NumberOfPages; x++)
{
string currentText = "";
currentText = PdfTextExtractor.GetTextFromPage(pdfReader, x, strategy);
s.Add(currentText);
}
z++;
pdfReader.Close();
}