Element tag are not getting replaced in pdf document

Hi,

We are using aspose.pdf version 22.7.0.

When we are trying to replace element tag with string.empty, it is not replacing both the element but when we try to replace any one element it is working fine.

Below is the code snippet we are using to replace the element.

{
	using var doc = new Document(@"sample.pdf");
	List<TextFragment> textFragments = new List<TextFragment>();
	List<string> replaceTexts = new List<string>();
//this is not getting replaced in file
	replaceTexts.Add("$_physSig");
	replaceTexts.Add("$_sigDate");

//this is getting replaced but it adds additional word "$_"
	//replaceTexts.Add("physSig");
	//replaceTexts.Add("sigDate");
	replaceTexts.ForEach(replaceText =>
	{
		TextFragmentAbsorber absorber = new TextFragmentAbsorber(replaceText)
		{
			TextReplaceOptions = new TextReplaceOptions(TextReplaceOptions.ReplaceAdjustment.None)
		};
		doc.Pages.Accept(absorber);
		textFragments.AddRange(absorber.TextFragments.ToList());
	});

	foreach (TextFragment textFragment in textFragments)
	{
		var item = replaceTexts.FirstOrDefault(x => string.Equals(x, textFragment.Text, StringComparison.InvariantCultureIgnoreCase));
		if (item == null)
			continue;
		textFragment.Text = string.Empty;
	}
	doc.Save(@"replaced.pdf");
}

Attached is the document for which we are facing an issue.

sample1.pdf (263.7 KB)

Note : We have tested with aspose.pdf version 22.7.0 as well as 23.7.0. And in both version we are facing the same issue.

@jsign

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55167

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.