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

Free Support Forum - aspose.com

Problem with glyphs (font) rendering after text replacement

Hi. I’ve got problems with font rendering after replacement:
Original text fragment has “ArialMT” font (it not install on my local machine). When I set new text value the font become “Arial”. And result pdf file for some reason can’t render it well (see attached screen).
image.png (19.5 KB)

Could you, pls, describe the reason why?

Java code snippet

    var document = new Document("medical_history.pdf");
    var page = document.getPages().get_Item(3);
    var absorber = new TextFragmentAbsorber();

    var textFragment = absorber.getTextFragments().get_Item(1);
    System.out.println("Font BEFORE replacement: " + textFragment.getTextState().getFont().getFontName());
    textFragment.setText("[Medical History]");
    System.out.println("Font AFTER  replacement: " + textFragment.getTextState().getFont().getFontName());

    var newDocument = new Document();

Original file: medical_history.pdf (220.3 KB)


A ticket with ID PDFJAVA-40818 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.