WholeWordsHyphenation works as ShiftRestOfLine in case replacement value is long

Java version: 11
Aspose PDF version: 21.8

Code sample:

Document doc = new Document("test.pdf");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber();
textFragmentAbsorber.setPhrase("34");
textFragmentAbsorber.setTextReplaceOptions(new TextReplaceOptions(WholeWordsHyphenation, 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");
doc.save("D:/test_output.pdf");

test.pdf (59.9 KB)
test_output.pdf (59.0 KB)

@pshchasny

I am getting different output for ShiftRestOfLine and WholeWordsHyphenation so I request you to explain the issue with snapshots.

In my opinion WholeWordsHyphenation should wrap words, but on the last line result looks as after using ShiftRestOfLine - no wrapping there and the last word is cut.

@pshchasny

A ticket with ID PDFJAVA-40900 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

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