Aspose PDF For Java: Text Replacement not wrapping text to multiple lines

Hi,
I am using Java Aspose-pdf (21.11) licensed version. After replacing the text in the PDF with a very long text, the updated text is not getting wrapped to multiple lines.

Followed the suggestion from,

TxtReplace.pdf => source pdf TxtReplace.pdf (6.2 KB)

TxtReplace1693248536421.pdf => text replaced pdf TxtReplace1693248536421.pdf (70.8 KB)

My code is as below,

final Document document = new Document("TxtReplace.pdf");

final TextFragmentAbsorber fragmentAbsorber = new TextFragmentAbsorber("{{Name}}");

fragmentAbsorber.getTextSearchOptions().setRegularExpressionUsed(false);
TextSearchOptions textSearchOptions = new TextSearchOptions(false);
fragmentAbsorber.setTextSearchOptions(textSearchOptions);    
`fragmentAbsorber.getTextReplaceOptions().setReplaceAdjustmentAction(TextReplaceOptions.ReplaceAdjustment.WholeWordsHyphenation);`

document.getPages().accept(fragmentAbsorber);
final TextFragmentCollection textFragments = fragmentAbsorber.getTextFragments();

if (textFragments.size() == 0)
    return;

fragmentAbsorber.reset();

for (final TextFragment fragment : textFragments)
{
    fragment.setText("BEGIN- ReplacedText ReplacedText ReplacedText ReplacedText ReplacedText ReplacedText ReplacedText ReplacedText ReplacedText ReplacedText ReplacedText ReplacedText-END");
}

    document.save("TxtReplace" + System.currentTimeMillis() + ".pdf");

@npadmawar

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): PDFJAVA-43083

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.

@asad.ali

Thanks for the update. Could you please confirm that getting paid support will lead to fixing this issue?

@npadmawar

Yes, paid support would definitely escalate things in terms of getting ETA information quicker. Also, the ticket will be expedited to the highest priority.

The issues you have found earlier (filed as PDFJAVA-43083) have been fixed in Aspose.PDF for Java 23.11.