List of usage examples for com.itextpdf.text.pdf PdfContentByte setAction
public void setAction(final PdfAction action, final float llx, final float lly, final float urx, final float ury)
From source file:com.vectorprint.report.itext.debug.DebugHelper.java
License:Open Source License
public static void styleLink(PdfContentByte canvas, String styleClass, String extraInfo, float x, float y, EnhancedMap settings, LayerManager layerAware) { if (styleClass == null) { log.warning("not showing link to styleClass because there is no styleClass"); return;//from w w w . j av a2 s . c o m } Font dbf = DebugHelper.debugFontLink(canvas, settings); layerAware.startLayerInGroup(DEBUG, canvas); PdfAction act = PdfAction.gotoLocalPage(styleClass, true); Chunk c = new Chunk(styleClass + extraInfo, dbf); float w = ItextHelper.getTextWidth(c); float h = ItextHelper.getTextHeight(c); float tan = (float) Math.tan(Math.toRadians(8)); canvas.setAction(act, x, y, x + w, y + h + tan * w); ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, new Phrase(c), x, y, 8); canvas.endLayer(); }