List of usage examples for com.lowagie.text.pdf PdfAnnotation setBorderStyle
public void setBorderStyle(PdfBorderDictionary border)
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); } } } }