Invisible and overlapping text issues after text replacement

Hello.
After text replacement in paragraph placed in the table cell - last words in paragraph become invisible.
Example 1: Invisible text.gif (233.5 KB)

In case when paragraph placed not in the table cell - after replacement we get overlapping text.
Example 2: overlapping text.png (89.5 KB)

Java version: 11
Aspose PDF version: 22.2

Code snippet

	@Test
	void example() throws IOException {
		var inputStream = new ClassPathResource("pdf/testParagraphCrossesTableCell.pdf").getInputStream();
		Document doc = new Document(inputStream);
		TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber();
		textFragmentAbsorber.setPhrase("34");
		textFragmentAbsorber.setTextReplaceOptions(new TextReplaceOptions(WholeWordsHyphenation, TextReplaceOptions.Scope.REPLACE_FIRST));
		textFragmentAbsorber.visit(doc.getPages().get_Item(1));
		TextFragmentCollection textFragments = textFragmentAbsorber.getTextFragments();
		textFragments.get_Item(1).setText("444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444");
		textFragments.get_Item(2).setText("444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444 444");
		doc.save("result.pdf");
	}

source file: testParagraphCrossesTableCell.pdf (61.0 KB)
result file: result.pdf (60.1 KB)

@dkuksa

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as PDFJAVA-41432. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.