how to set header font color in iText

2019-06-19 18:09发布

问题:

HeaderFooter header = 
      new HeaderFooter(new Phrase("test", new Font(bf_times)), false);
header.setAlignment(Element.ALIGN_CENTER);
header.setBackgroundColor(new Color(0xB5091E));

document.setHeader(header);

I want to set the Font color for test to white (FFFFFF)

回答1:

The Font is the class holding the color.

Font font = new Font(bf_times)
font.setColor(Color.WHITE);

This should do it.



标签: itext