We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Text overlapping after replacement

Java version: 11
Aspose PDF Version: 21.8

        Document doc = new Document("D:/test_overlapping.pdf");
        TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber();
        textFragmentAbsorber.setPhrase("requirements");
        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("requirements and responsibilities");
        doc.save("D:/test_overlapping_result.pdf");

test_overlapping.pdf (101.4 KB)
test_overlapping_result.pdf (102.3 KB)

@pshchasny

We were able to reproduce the issue in our environment while using Aspose.PDF for Java 21.9. Therefore, we have logged it as PDFJAVA-40898 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

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