Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a pdf file I need to compare a Number with PDF Text if it matched then I will save the pdf file. The problem is I am not able to read some text which is in input box. I just need to read "LICI0318245279" from following pdf file. here is the link : https://www.dropbox.com/s/g45usoyrz4vua9r/3.pdf
C#
PdfReader pdfReader = new PdfReader(Server.MapPath("1.pdf"));
string TempFilename = Path.GetTempFileName();
AcroFields pdfFormFields = pdfReader.AcroFields;
foreach (KeyValuePair<string, AcroFields.Item> kvp in pdfFormFields.Fields)
{   
  string fieldName = kvp.Key.ToString();
  string fieldValue = pdfFormFields.GetField(kvp.Key.ToString());
  Console.WriteLine(fieldName + " " + fieldValue);
}

pdfReader.Close();

I have also tried to read all fields from pdf but in result I am not getting any field or its value.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900