❔ List contains 600+ lines, the file that it writes to contains only 130, why?
I got a pdf with a few pages, alot of lines, anybody got and idea?
When i stop on debug, wordsInPage contains 600+ lines.
that's the entire code:
When i stop on debug, wordsInPage contains 600+ lines.
that's the entire code:
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());
}