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

Free Support Forum - aspose.com

Bold TextSegments with TabStops are not bold anymore since 20.7

Since Aspose.Pdf for Java 20.7 (all versions since), individual style in TextSegment elements seems to be completely ignored; instead the style for the TextFragment seems to override individual settings.

The following code reproduces the issue. Below the code, the example of how it was correct until 20.6, and the issue since 20.7

import com.aspose.pdf.*;

public class TestClass {
    private static final String ABSOLUTE_FILEPATH = "boldtext-test.pdf";

    public static void main(String[] args) throws Exception {
        Document document = new Document();
        Page page = document.getPages().insert(1);

        TextFragment txt = new TextFragment(new TabStops());
        txt.getTextState().getTabStops().add(100);
        TextSegment bold = new TextSegment("This MUST be bold");
        bold.getTextState().setFontStyle(FontStyles.Bold);
        txt.getSegments().add(bold);
        txt.getSegments().add(new TextSegment("#$TAB"));
        txt.getSegments().add(new TextSegment("This is regular"));
        page.getParagraphs().add(txt);

        document.save(ABSOLUTE_FILEPATH);
    }
}

20.6: aspose-20.6.png (19.0 KB)

20.7: aspose-20.7.png (18.6 KB)

@PeteLee

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as PDFNET-41110. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.