Example usage for com.itextpdf.text.pdf PdfContentByte setAction

List of usage examples for com.itextpdf.text.pdf PdfContentByte setAction

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfContentByte setAction.

Prototype

public void setAction(final PdfAction action, final float llx, final float lly, final float urx,
        final float ury) 

Source Link

Document

Implements an action in an area.

Usage

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();
}