List of usage examples for com.lowagie.text ElementTags ANCHOR
String ANCHOR
To view the source code for com.lowagie.text ElementTags ANCHOR.
Click Source Link
From source file:org.apache.maven.doxia.module.itext.ITextSink.java
License:Apache License
/** {@inheritDoc} */ public void link(String name) { if (name == null) { throw new NullPointerException("Link name cannot be null!"); }//from www . j ava2s. c om font.setColor(Color.BLUE); font.addUnderlined(); writeStartElement(ElementTags.ANCHOR); if (StringUtils.isNotEmpty(name) && name.startsWith("#") && StringUtils.isNotEmpty(header.getTitle())) { name = "#" + DoxiaUtils.encodeId(header.getTitle(), true) + "_" + name.substring(1); } writeAddAttribute(ElementTags.REFERENCE, HtmlTools.escapeHTML(name)); writeAddAttribute(ElementTags.FONT, font.getFontName()); writeAddAttribute(ElementTags.SIZE, font.getFontSize()); writeAddAttribute(ElementTags.STYLE, font.getFontStyle()); writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue()); writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen()); writeAddAttribute(ElementTags.RED, font.getFontColorRed()); actionContext.setAction(SinkActionContext.LINK); }
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!"); }//from w ww .j a va 2 s.co 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); }