public static List <Informations> PdfText(string path) { PdfReader reader = new PdfReader(path); string text = string.Empty; for (int page = 1; page <= reader.NumberOfPages; page++) { if (page == 1) { partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 200, weight, height - 80)); // for part 1 partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 380, weight, height - 200)); // for part 2 partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 500, weight, height - 380)); // for part 3 partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 660, weight, height - 500)); // for part 4 partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 820, weight, height - 660)); // for part 5 } else { partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 190, weight, height - 50)); // for part 1 partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 340, weight, height - 190)); // for part 2 partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 480, weight, height - 340)); // for part 3 partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 620, weight, height - 480)); // for part 4 partTexts.Add(GetPdfFields.GetRectangle(reader, page, 0, height - 750, weight, height - 620)); // for part 5 } } reader.Close(); partTextAddToList(partTexts); return(listOfInformations); }
public static void partTextAddToList(List <string> partTexts) { foreach (var partText in partTexts) { var transferGate = GetPdfFields.GetGate(partText); if (transferGate.Contains("TUR")) { Informations inf = new Informations { EmployeeName = GetPdfFields.GetName(partText), TranferGate = transferGate, CardNo = GetPdfFields.GetCardNo(partText), Date = GetPdfFields.GetDate(partText) }; listOfInformations.Add(inf); } } }