I have a pdf file which i am Reading as string page by page.Now from page 4 onwards my pdf contains billing information.These Billing information are under section for Example :- say one is Local Billing information and other is STD billing information etc.Now as per my requirement if user wants to validate Local Billing information my code should read all the Local Billing data and validate it,in case any data(row) validation gets failed it should highlight that row of the PDF File.
Here is my Code in c#
public static string ReadPdfFile(string fileName)
{
StringBuilder text = new StringBuilder();
if (File.Exists(fileName))
{
PdfReader pdfReader = new PdfReader(fileName);
for (int page = 2; page <= pdfReader.NumberOfPages; page++)
{
ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
string currentText = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy);
currentText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(currentText)));
text.Append(currentText);
}
pdfReader.Close();
}
return text.ToString();
}
}