What replaces a piece in iText 7?

Trying to use iText 7 in java. You want the paragraph to appear in bold. Apparently, in previous releases, this was done by formatting the β€œpieces” separately, and then adding them to the paragraph. Apparently, "pieces" do not exist in iText 7. What is the procedure for iText 7?

+5
source share
1 answer

Text in com.itextpdf.layout.element means an alternative for Chunk .

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

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

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

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

Please check out the bouncing tutorial written by Bruno Loudzhi.

+8
source

All Articles