Example usage for com.itextpdf.text.pdf BaseField setTextColor

List of usage examples for com.itextpdf.text.pdf BaseField setTextColor

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf BaseField setTextColor.

Prototype

public void setTextColor(BaseColor textColor) 

Source Link

Document

Sets the text color.

Usage

From source file:com.vectorprint.report.itext.style.stylers.FieldFont.java

License:Open Source License

@Override
public <E> E style(E element, Object data) throws VectorPrintException {
    element = super.style(element, data);
    BaseField bf = getFromCell(element);
    if (bf != null) {

        com.itextpdf.text.Font f = FontFactory.getFont(getValue(FAMILY_PARAM, String.class),
                getValue(SIZE_PARAM, Float.class), getValue(STYLE_PARAM, Font.STYLE.class).getStyle());
        if (f.getBaseFont() == null) {
            throw new VectorPrintRuntimeException(
                    "font " + f.getFamilyname() + " does not have a basefont, check your fontloading");
        }//from   w ww .  j a  v a  2 s . com
        bf.setFont(f.getBaseFont());
        bf.setFontSize(getValue(SIZE_PARAM, Float.class));
        bf.setTextColor(itextHelper.fromColor(getValue(COLOR_PARAM, Color.class)));
    }
    return element;
}