What replaces chunk in iText 7?

后端 未结 1 897
不思量自难忘°
不思量自难忘° 2021-01-17 16:32

Attempting to use iText 7 in java. Want to have part of a paragraph be bold. Apparently in earlier releases this was done by formatting \"chunks\" separately then adding t

相关标签:
1条回答
  • 2021-01-17 17:35

    Text in com.itextpdf.layout.element is meant to be an alternative for Chunk.

    To make a part of a paragraph bold, you would need a bold font to be specified for a piece of a text.

    Paragraph p = new Paragraph();
    p.add(new Text("this will be in bold").setFont(boldFont));
    

    Alternatively, you can rely on iText to simulate bold for regular font, but this is not a preferred way.

    p.add(new Text("bold will be simulated for regular font").setBold());
    

    Please check out the jumpstart tutorial written by Bruno Lowagie.

    0 讨论(0)
提交回复
热议问题