Example usage for com.lowagie.text.pdf PdfAnnotation setBorderStyle

List of usage examples for com.lowagie.text.pdf PdfAnnotation setBorderStyle

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfAnnotation setBorderStyle.

Prototype

public void setBorderStyle(PdfBorderDictionary border) 

Source Link

Usage

From source file:org.eclipse.birt.report.engine.emitter.pdf.PDFPage.java

License:Open Source License

protected void showHelpText(float x, float y, float width, float height, String helpText) {
    Rectangle rectangle = new Rectangle(x, y, x + width, y + height);
    PdfAnnotation annotation = PdfAnnotation.createSquareCircle(writer, rectangle, helpText, true);
    PdfBorderDictionary borderStyle = new PdfBorderDictionary(0, PdfBorderDictionary.STYLE_SOLID, null);
    annotation.setBorderStyle(borderStyle);
    annotation.setFlags(288);/*from www  .  j  av a 2  s  .  c o  m*/
    writer.addAnnotation(annotation);
}

From source file:org.xhtmlrenderer.pdf.ITextOutputDevice.java

License:Open Source License

private void processLink(RenderingContext c, Box box) {
    Element elem = box.getElement();
    if (elem != null) {
        NamespaceHandler handler = _sharedContext.getNamespaceHandler();
        String uri = handler.getLinkUri(elem);
        if (uri != null) {
            if (uri.length() > 1 && uri.charAt(0) == '#') {
                String anchor = uri.substring(1);
                Box target = _sharedContext.getBoxById(anchor);
                if (target != null) {
                    PdfDestination dest = createDestination(c, target);

                    if (dest != null) {
                        PdfAction action = new PdfAction();
                        if (!"".equals(handler.getAttributeValue(elem, "onclick"))) {
                            action = PdfAction.javaScript(handler.getAttributeValue(elem, "onclick"), _writer);
                        } else {
                            action.put(PdfName.S, PdfName.GOTO);
                            action.put(PdfName.D, dest);
                        }//  ww  w  . j a v a  2s  .c o m

                        com.lowagie.text.Rectangle targetArea = checkLinkArea(c, box);
                        if (targetArea == null) {
                            return;
                        }

                        targetArea.setBorder(0);
                        targetArea.setBorderWidth(0);

                        PdfAnnotation annot = new PdfAnnotation(_writer, targetArea.getLeft(),
                                targetArea.getBottom(), targetArea.getRight(), targetArea.getTop(), action);
                        annot.put(PdfName.SUBTYPE, PdfName.LINK);
                        annot.setBorderStyle(new PdfBorderDictionary(0.0f, 0));
                        annot.setBorder(new PdfBorderArray(0.0f, 0.0f, 0));
                        _writer.addAnnotation(annot);
                    }
                }
            } else if (uri.indexOf("://") != -1) {
                PdfAction action = new PdfAction(uri);

                com.lowagie.text.Rectangle targetArea = checkLinkArea(c, box);
                if (targetArea == null) {
                    return;
                }
                PdfAnnotation annot = new PdfAnnotation(_writer, targetArea.getLeft(), targetArea.getBottom(),
                        targetArea.getRight(), targetArea.getTop(), action);
                annot.put(PdfName.SUBTYPE, PdfName.LINK);

                annot.setBorderStyle(new PdfBorderDictionary(0.0f, 0));
                annot.setBorder(new PdfBorderArray(0.0f, 0.0f, 0));
                _writer.addAnnotation(annot);
            }
        }
    }
}