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

Free Support Forum - aspose.com

Wrapped text is invisible

Java version: 11
Aspose PDF version: 21.8

Code sample:

PdfContentEditor editor = new PdfContentEditor();
editor.bindPdf("test_invisible_words.pdf");
editor.getTextReplaceOptions().setReplaceAdjustmentAction(TextReplaceOptions.ReplaceAdjustment.WholeWordsHyphenation);
editor.replaceText("34", 1, "444");
editor.save("test_invisible_words_result.pdf");

Result: “drug.” is invisible.

The same happens when I use TextFragmentAbsorber

Document doc = new Document("test_invisible_words.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");
doc.save("test_invisible_words_output.pdf");

test_invisible_words.pdf (51.2 KB)
test_invisible_words_output.pdf (52.9 KB)

Do you have some workaround for it?
How can I detect this issue programmatically?

@pshchasny

A ticket with ID PDFJAVA-40897 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 issue may not be detected programmatically.