private void Action_HasText(string pdfPath, string text) { if (System.IO.File.Exists(pdfPath) == false) { MessageBox.Show("File does not exist"); return; } PdfDocument doc = PdfDocument.Load(pdfPath); IEnumerable <int> selectedPages = GetSelectedPages(doc.Pages.Count); List <string> lines = new List <string>(); int pageNum = 0; foreach (PdfDocumentPage page in doc.Pages) { pageNum++; if (selectedPages.Contains(pageNum) == false) { continue; } PdfTextExtractor extractor = new PdfTextExtractor(page); lines.Add(string.Format("Page({0}) : {1}", pageNum, Convert.ToString(extractor.HasText(text)))); } txtOutput.Lines = lines.ToArray(); }