Example usage for com.lowagie.text ElementTags NAME

List of usage examples for com.lowagie.text ElementTags NAME

Introduction

In this page you can find the example usage for com.lowagie.text ElementTags NAME.

Prototype

String NAME

To view the source code for com.lowagie.text ElementTags NAME.

Click Source Link

Document

attribute of anchor tag

Usage

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void anchor(String name) {
    if (name == null) {
        throw new NullPointerException("Anchor name cannot be null!");
    }//  www  . j av a 2 s  .c o m

    if (StringUtils.isNotEmpty(header.getTitle())) {
        name = header.getTitle() + "_" + name;
    }
    String id = name;

    if (!DoxiaUtils.isValidId(id)) {
        id = DoxiaUtils.encodeId(name, true);

        String msg = "Modified invalid link: '" + name + "' to '" + id + "'";
        logMessage("modifiedLink", msg);
    }

    writeStartElement(ElementTags.ANCHOR);
    writeAddAttribute(ElementTags.NAME, id);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());

    actionContext.setAction(SinkActionContext.ANCHOR);
}