List of usage examples for com.lowagie.text.pdf PdfOutline setStyle
public void setStyle(int style)
From source file:org.eclipse.birt.report.engine.emitter.pdf.TOCHandler.java
License:Open Source License
/** * create a PDF outline for tocNode, using the pol as the parent PDF * outline.//from w ww . ja v a2s . c o m * * @param tocNode * The tocNode whose kids need to build a PDF outline tree * @param pol * The parent PDF outline for these kids * @param bookmarks * All bookMarks created during rendering */ protected void createTOC(TOCNode tocNode, PdfOutline pol, Set<String> bookmarks) { if (isOutlineSizeOverflow()) return; if (null == tocNode || null == tocNode.getChildren()) return; for (Iterator i = tocNode.getChildren().iterator(); i.hasNext();) { TOCNode node = (TOCNode) i.next(); if (!bookmarks.contains(node.getBookmark())) { createTOC(node, outline, bookmarks); continue; } PdfOutline outline = new PdfOutline(pol, PdfAction.gotoLocalPage(node.getBookmark(), false), node.getDisplayString()); countOutlineSize(node.getBookmark().length()); IScriptStyle style = node.getTOCStyle(); String color = style.getColor(); if (color != null) { color = color.toLowerCase(); } Color awtColor = PropertyUtil.getColor(color); if (awtColor != null) { outline.setColor(awtColor); } String fontStyle = style.getFontStyle(); String fontWeight = style.getFontWeight(); int styleValue = PropertyUtil.getFontStyle(fontStyle, fontWeight); outline.setStyle(styleValue); createTOC(node, outline, bookmarks); } }