We are using below code to replace string with blank in PDF file. We are facing issue of taking more memory. mainly doc.Pages.Accept(absorber). Do you have any other option with minimum memory. We are using 21.12 version.
string pattern = “HORIZON/WINDOW|Revolutions start|ULAGE”;
Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
var textSearchOptions = new TextSearchOptions(true);
TextFragmentAbsorber absorber = new TextFragmentAbsorber(regex);
absorber.TextSearchOptions = textSearchOptions;
absorber.TextReplaceOptions = new TextReplaceOptions(TextReplaceOptions.ReplaceAdjustment.None);
doc.Pages.Accept(absorber);
TextFragmentCollection textFragmentCollection = absorber.TextFragments;
foreach (TextFragment textFragment in textFragmentCollection)
{
textFragment.Text = string.Empty;
}