PDBorderStyleDictionary borderStyle = new PDBorderStyleDictionary(); String width = element.getAttribute("width"); if (width != null && !width.isEmpty()) borderStyle.setWidth(Float.parseFloat(width)); if (borderStyle.getWidth() > 0) borderStyle.setStyle("D"); break; case "bevelled": borderStyle.setStyle("B"); break; case "inset": borderStyle.setStyle("I"); break; case "underline": borderStyle.setStyle("U"); break; case "cloudy": borderStyle.setStyle("S"); PDBorderEffectDictionary borderEffect = new PDBorderEffectDictionary(); borderEffect.setStyle("C"); break; default: borderStyle.setStyle("S"); break;
/** * This will retrieve the border style, see the STYLE_* constants for valid values. * * @return the style of the border */ public String getStyle() { return getCOSObject().getNameAsString(COSName.S, STYLE_SOLID); }
ab.width = borderStyle.getWidth(); if (borderStyle.getStyle().equals(PDBorderStyleDictionary.STYLE_DASHED)) ab.dashArray = borderStyle.getDashStyle().getDashArray(); if (borderStyle.getStyle().equals(PDBorderStyleDictionary.STYLE_UNDERLINE))
/** * Convenience method for annotations: sets the line with and dash style. * * @param lineWidth The line width. * @param bs The border style, may be null. * @param border The border array, must have at least three entries. This is * only used if the border style is null. * * @throws IOException If there is an error writing to the content stream. */ public void setBorderLine(float lineWidth, PDBorderStyleDictionary bs, COSArray border) throws IOException { // Can't use PDBorderStyleDictionary.getDashStyle() as // this will return a default dash style if non is existing if (bs != null && bs.getCOSObject().containsKey(COSName.D) && bs.getStyle().equals(PDBorderStyleDictionary.STYLE_DASHED)) { setLineDashPattern(bs.getDashStyle().getDashArray(), 0); } else if (bs == null && border.size() > 3 && border.getObject(3) instanceof COSArray) { setLineDashPattern(((COSArray) border.getObject(3)).toFloatArray(), 0); } setLineWidthOnDemand(lineWidth); }
widget.setRectangle(new PDRectangle(30, PDRectangle.A4.getHeight() - 40 - i * 35, 30, 30)); widget.setAppearanceCharacteristics(appearanceCharacteristics); PDBorderStyleDictionary borderStyleDictionary = new PDBorderStyleDictionary(); borderStyleDictionary.setWidth(2); borderStyleDictionary.setStyle(PDBorderStyleDictionary.STYLE_SOLID); widget.setBorderStyle(borderStyleDictionary); widget.setPage(page);
/** * This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the * annotation. * * @return the border style dictionary. */ public PDBorderStyleDictionary getBorderStyle() { COSDictionary bs = (COSDictionary) annot.getDictionaryObject(COSName.BS); if (bs != null) { return new PDBorderStyleDictionary(bs); } else { return null; } }
static float getLineWidth(PDAnnotationWidget widget) { PDBorderStyleDictionary bs = widget.getBorderStyle(); if (bs != null) { return bs.getWidth(); } return 1; }
PDBorderStyleDictionary borderULine = new PDBorderStyleDictionary(); borderULine.setWidth(0); txtLink.setBorderStyle(borderULine); PDActionGoTo action = (PDActionGoTo) actionsMap.get(key);
public void setBorderLine(float lineWidth, PDBorderStyleDictionary bs) throws IOException { // Can't use PDBorderStyleDictionary.getDashStyle() as // this will return a default dash style if non is existing if (bs != null && (bs.getCOSObject().containsKey(COSName.D))) { setLineDashPattern(bs.getDashStyle().getDashArray(), 0); } else { setLineWidthOnDemand(lineWidth); } }
annotation.getBorderStyle().getStyle().equals(PDBorderStyleDictionary.STYLE_UNDERLINE))
widget.setAppearanceCharacteristics(appearanceCharacteristics); PDBorderStyleDictionary borderStyleDictionary = new PDBorderStyleDictionary(); borderStyleDictionary.setWidth(1); borderStyleDictionary.setStyle(PDBorderStyleDictionary.STYLE_SOLID); widget.setBorderStyle(borderStyleDictionary);
/** * This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the line. * * @return the border style dictionary. */ public PDBorderStyleDictionary getBorderStyle() { COSBase bs = getCOSObject().getDictionaryObject(COSName.BS); if (bs instanceof COSDictionary) { return new PDBorderStyleDictionary((COSDictionary) bs); } return null; }
static float getLineWidth(PDAnnotationWidget widget) { PDBorderStyleDictionary bs = widget.getBorderStyle(); if (bs != null) { return bs.getWidth(); } return 1; } }
private void addLinkToPage(PDPage page, PDAnnotationLink annot) { PDBorderStyleDictionary styleDict = new PDBorderStyleDictionary(); styleDict.setWidth(0); styleDict.setStyle(PDBorderStyleDictionary.STYLE_SOLID); annot.setBorderStyle(styleDict); try { List<PDAnnotation> annots = page.getAnnotations(); if (annots == null) { annots = new ArrayList<PDAnnotation>(); page.setAnnotations(annots); } annots.add(annot); } catch (IOException e) { throw new PdfContentStreamAdapter.PdfException("processLink", e); } }
PDBorderStyleDictionary borderStyle = new PDBorderStyleDictionary(); String width = element.getAttribute("width"); if (width != null && !width.isEmpty()) borderStyle.setWidth(Float.parseFloat(width)); if (borderStyle.getWidth() > 0) borderStyle.setStyle("D"); borderStyle.setStyle("B"); borderStyle.setStyle("I"); borderStyle.setStyle("U"); borderStyle.setStyle("S"); PDBorderEffectDictionary borderEffect = new PDBorderEffectDictionary(); borderEffect.setStyle("C"); borderStyle.setStyle("S"); borderStyle.setDashStyle(dashPattern);
/** * This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the line. * * @return the border style dictionary. */ public PDBorderStyleDictionary getBorderStyle() { COSBase bs = getCOSObject().getDictionaryObject(COSName.BS); if (bs instanceof COSDictionary) { return new PDBorderStyleDictionary((COSDictionary) bs); } return null; } }
return bs.getWidth();
ab.width = borderStyle.getWidth(); if (borderStyle.getStyle().equals(PDBorderStyleDictionary.STYLE_DASHED)) ab.dashArray = borderStyle.getDashStyle().getDashArray(); if (borderStyle.getStyle().equals(PDBorderStyleDictionary.STYLE_UNDERLINE))
/** * This will set the border style, see the STYLE_* constants for valid values. * * @param s the border style to use */ public void setStyle(String s) { getCOSObject().setName(COSName.S, s); }
private void addLinkToPage(PDPage page, PDAnnotationLink annot) { PDBorderStyleDictionary styleDict = new PDBorderStyleDictionary(); styleDict.setWidth(0); styleDict.setStyle(PDBorderStyleDictionary.STYLE_SOLID); annot.setBorderStyle(styleDict); try { List<PDAnnotation> annots = page.getAnnotations(); if (annots == null) { annots = new ArrayList<PDAnnotation>(); page.setAnnotations(annots); } annots.add(annot); } catch (IOException e) { throw new PdfContentStreamAdapter.PdfException("processLink", e); } }