@SuppressWarnings("unchecked") protected void fillColumnText(List<HashMap<String, Object>> bookmarkList, ColumnText ct, float leftIndent, int depth) { if (null != bookmarkList) { for (int i = 0; i < bookmarkList.size(); i++) { HashMap<String, Object> bookmark = bookmarkList.get(i); String title = (String) bookmark.get("Title"); String pageNum = ((String) bookmark.get("Page")).split(" ")[0]; Paragraph paragraph = new Paragraph(title); paragraph.add(new Chunk(new DottedLineSeparator())); paragraph.add(Integer.toString((Integer.parseInt(pageNum)))); paragraph.setIndentationLeft(leftIndent * depth); paragraph.setSpacingBefore(0 == depth ? 9 : 0); ct.addElement(paragraph); fillColumnText(((List<HashMap<String, Object>>) bookmark.get("Kids")), ct, leftIndent, depth + 1); } } }
@Override public void onRender(com.itextpdf.text.Paragraph paragraph) { DottedLineSeparator sep = new DottedLineSeparator(); sep.setAlignment( Element.ALIGN_LEFT ); sep.setGap( gap ); sep.setLineColor( getBaseColor()); com.itextpdf.text.Font f = new com.itextpdf.text.Font( getBaseFont(), getFontSize() ); f.setColor( getBaseColor() ); Chunk separator = new Chunk( sep ); separator.setFont( f ); paragraph.add( separator ); }
public Phrase DotLine() { Phrase section = new Phrase(); DottedLineSeparator dottedLine = new DottedLineSeparator(); dottedLine.setGap(2); section.add(new Chunk(dottedLine)); return section; }