static List <IEnumerable <string> > ReadPdf(PdfDocument doc) { doc.Pages.RemoveAt(0); List <IEnumerable <string> > texts = new List <IEnumerable <string> >(); foreach (PdfPage page in doc.Pages) { //Converts each PDF page into a collection of strings //The actual code to do so was copied from StackOverflow and is not important IEnumerable <string> q = PdfSharpExtensions.ExtractText(page); texts.Add(q); } return(texts); }
public ActionResult<string> Get(int id) { //var a =NOPIHandler.ReadWordText(@"D:\Data\test\1.docx"); const string filename = @"D:\Data\test\5.pdf"; PdfDocument document = PdfReader.Open(filename); var list = new List<string>(); foreach (var page in document.Pages) { var text = PdfSharpExtensions.ExtractText(page); //var plist = text.ToList(); list.AddRange(text); } return string.Join(",", list.ToArray()); }