/** * 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); }
/** * 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); }
/** * This will retrieve the border width in points, 0 = no border. * * @return The width of the border in points. */ public float getWidth() { if (getCOSObject().getDictionaryObject(COSName.W) instanceof COSName) { // replicate Adobe behavior although it contradicts the specification // https://github.com/mozilla/pdf.js/issues/10385 return 0; } return getCOSObject().getFloat(COSName.W, 1); }
/** * This will set the dash style used for drawing the border. * * @param dashArray the dash style to use */ public void setDashStyle(COSArray dashArray) { COSArray array = null; if (dashArray != null) { array = dashArray; } getCOSObject().setItem(COSName.D, array); }
/** * This will set the border width in points, 0 = no border. * * There is a bug in Adobe Reader DC, float values are ignored for text field widgets. As a * workaround, floats that are integers (e.g. 2.0) are written as integer in the PDF. * <p> * In Adobe Acrobat DC, the values are shown as "0 = Invisible, 1 = Thin, 2 = Medium, 3 = Thick" * for widget and link annotations. * * @param w float the width in points */ public void setWidth(float w) { // PDFBOX-3929 workaround if (Float.compare(w, (int) w) == 0) { getCOSObject().setInt(COSName.W, (int) w); } else { getCOSObject().setFloat(COSName.W, w); } }
/** * This will retrieve the dash style used for drawing the border. * * @return the dash style of the border */ public PDLineDashPattern getDashStyle() { COSArray d = (COSArray) getCOSObject().getDictionaryObject(COSName.D); if (d == null) { d = new COSArray(); d.add(COSInteger.THREE); getCOSObject().setItem(COSName.D, d); } return new PDLineDashPattern(d, 0); }
/** * 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); }
/** * 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("S", s); }
/** * 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("S", STYLE_SOLID); }
/** * This will retrieve the border width in points, 0 = no border. * * @return The width of the border in points. */ public float getWidth() { return getCOSObject().getFloat("W", 1); }
/** * 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("S", s); }
/** * This will retrieve the border width in points, 0 = no border. * * @return The width of the border in points. */ public float getWidth() { return getCOSObject().getFloat("W", 1); }
/** * 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("S", STYLE_SOLID); }
/** * This will set the dash style used for drawing the border. * * @param dashArray the dash style to use */ public void setDashStyle(COSArray dashArray) { COSArray array = null; if (dashArray != null) { array = dashArray; } getCOSObject().setItem("D", array); }
/** * This will set the dash style used for drawing the border. * * @param dashArray the dash style to use */ public void setDashStyle(COSArray dashArray) { COSArray array = null; if (dashArray != null) { array = dashArray; } getCOSObject().setItem("D", array); }
/** * This will set the border width in points, 0 = no border. * * There is a bug in Adobe Reader DC, float values are ignored for text field widgets. As a * workaround, floats that are integers (e.g. 2.0) are written as integer in the PDF. * <p> * In Adobe Acrobat DC, the values are shown as "0 = Invisible, 1 = Thin, 2 = Medium, 3 = Thick" * for widget and link annotations. * * @param w float the width in points */ public void setWidth(float w) { // PDFBOX-3929 workaround if (w == (int) w) { getCOSObject().setInt("W", (int) w); } else { getCOSObject().setFloat("W", w); } }
/** * This will set the border width in points, 0 = no border. * * There is a bug in Adobe Reader DC, float values are ignored for text field widgets. As a * workaround, floats that are integers (e.g. 2.0) are written as integer in the PDF. * <p> * In Adobe Acrobat DC, the values are shown as "0 = Invisible, 1 = Thin, 2 = Medium, 3 = Thick" * for widget and link annotations. * * @param w float the width in points */ public void setWidth(float w) { // PDFBOX-3929 workaround if (w == (int) w) { getCOSObject().setInt("W", (int) w); } else { getCOSObject().setFloat("W", w); } }
/** * This will retrieve the dash style used for drawing the border. * * @return the dash style of the border */ public PDLineDashPattern getDashStyle() { COSArray d = (COSArray) getCOSObject().getDictionaryObject("D"); if (d == null) { d = new COSArray(); d.add(COSInteger.THREE); getCOSObject().setItem("D", d); } return new PDLineDashPattern(d, 0); }
/** * This will retrieve the dash style used for drawing the border. * * @return the dash style of the border */ public PDLineDashPattern getDashStyle() { COSArray d = (COSArray) getCOSObject().getDictionaryObject("D"); if (d == null) { d = new COSArray(); d.add(COSInteger.THREE); getCOSObject().setItem("D", d); } return new PDLineDashPattern(d, 0); }
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); } }