using (PdfDocument document = PdfDocument.Open(@"C:\Users\myuser\Downloads\test1.PDF"))
{
var wordsToIntercept = new List<string>();
var pages = document.GetPages().ToList();
foreach (var page in pages)
{
var wordsInPage = page.GetWords().Select(w => w.Text).ToList();
var contains = wordsInPage.Contains("TJMAX");
foreach (var wordd in wordsInPage)
{
Console.WriteLine(wordd);
}
string docPath =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
// Write the string array to a new file named "WriteLines.txt".
using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "WriteLines.txt")))
{
foreach (string line in wordsInPage)
outputFile.WriteLine(line.ToUpper());
}
using (PdfDocument document = PdfDocument.Open(@"C:\Users\myuser\Downloads\test1.PDF"))
{
var wordsToIntercept = new List<string>();
var pages = document.GetPages().ToList();
foreach (var page in pages)
{
var wordsInPage = page.GetWords().Select(w => w.Text).ToList();
var contains = wordsInPage.Contains("TJMAX");
foreach (var wordd in wordsInPage)
{
Console.WriteLine(wordd);
}
string docPath =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
// Write the string array to a new file named "WriteLines.txt".
using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "WriteLines.txt")))
{
foreach (string line in wordsInPage)
outputFile.WriteLine(line.ToUpper());
}