Class FixedDashedBorder

java.lang.Object
com.itextpdf.layout.borders.Border
com.itextpdf.layout.borders.FixedDashedBorder

public class FixedDashedBorder extends Border
Draws a border with a specific dashes around the element it's been set to.
  • Field Details

    • DEFAULT_UNITS_VALUE

      public static final float DEFAULT_UNITS_VALUE
      Default dash unitsOn and unitsOff value.
      See Also:
  • Constructor Details

    • FixedDashedBorder

      public FixedDashedBorder (float width)
      Creates a FixedDashedBorder with the specified width.
      Parameters:
      width - width of the border
    • FixedDashedBorder

      public FixedDashedBorder (Color color, float width)
      Creates a FixedDashedBorder with the specified width and the specified color.
      Parameters:
      color - color of the border
      width - width of the border
    • FixedDashedBorder

      public FixedDashedBorder (Color color, float width, float opacity)
      Creates a FixedDashedBorder with the specified width, color and opacity.
      Parameters:
      color - color of the border
      width - width of the border
      opacity - the opacity which border should have
    • FixedDashedBorder

      public FixedDashedBorder (Color color, float width, float unitsOn, float unitsOff, float phase)
      Creates a FixedDashedBorder with the specified width, color, unitsOn, unitsOff and phase.
      Parameters:
      color - color of the border
      width - width of the border
      unitsOn - the number of units that must be 'on'
      unitsOff - the number of units that must be 'off'
      phase - the value of the phase
    • FixedDashedBorder

      public FixedDashedBorder (Color color, float width, float opacity, float unitsOn, float unitsOff, float phase)
      Creates a FixedDashedBorder with the specified width, color, opacity, unitsOn, unitsOff and phase.
      Parameters:
      color - color of the border
      width - width of the border
      opacity - the opacity which border should have
      unitsOn - the number of units that must be 'on'
      unitsOff - the number of units that must be 'off'
      phase - the value of the phase
  • Method Details

    • draw

      public void draw (PdfCanvas canvas, float x1, float y1, float x2, float y2, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
      All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction. Borders are drawn in this order: top, right, bottom, left.

      Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.

      borderWidthBefore and borderWidthAfter parameters are used to define the widths of the borders that are before and after the current border, e.g. for the bottom border, borderWidthBefore specifies width of the right border and borderWidthAfter - width of the left border. Those width are used to handle areas of border joins.

      Specified by:
      draw in class Border
      Parameters:
      canvas - PdfCanvas to be written to
      x1 - x coordinate of the beginning point of the element side, that should be bordered
      y1 - y coordinate of the beginning point of the element side, that should be bordered
      x2 - x coordinate of the ending point of the element side, that should be bordered
      y2 - y coordinate of the ending point of the element side, that should be bordered
      defaultSide - the Border.Side, that we will fallback to, if it cannot be determined by border coordinates
      borderWidthBefore - defines width of the border that is before the current one
      borderWidthAfter - defines width of the border that is after the current one
    • draw

      public void draw (PdfCanvas canvas, float x1, float y1, float x2, float y2, float horizontalRadius1, float verticalRadius1, float horizontalRadius2, float verticalRadius2, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)
      All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction. Borders are drawn in this order: top, right, bottom, left.

      Given points specify the line which lies on the border of the content area, therefore the border itself should be drawn to the left from the drawing direction.

      borderWidthBefore and borderWidthAfter parameters are used to define the widths of the borders that are before and after the current border, e.g. for the bottom border, borderWidthBefore specifies width of the right border and borderWidthAfter - width of the left border. Those width are used to handle areas of border joins.

      horizontalRadius1, verticalRadius1, horizontalRadius2 and verticalRadius2 are used to draw rounded borders.

      Overrides:
      draw in class Border
      Parameters:
      canvas - PdfCanvas to be written to
      x1 - x coordinate of the beginning point of the element side, that should be bordered
      y1 - y coordinate of the beginning point of the element side, that should be bordered
      x2 - x coordinate of the ending point of the element side, that should be bordered
      y2 - y coordinate of the ending point of the element side, that should be bordered
      horizontalRadius1 - defines the horizontal radius of the border's first corner
      verticalRadius1 - defines the vertical radius of the border's first corner
      horizontalRadius2 - defines the horizontal radius of the border's second corner
      verticalRadius2 - defines the vertical radius of the border's second corner
      defaultSide - the Border.Side, that we will fallback to, if it cannot be determined by border coordinates
      borderWidthBefore - defines width of the border that is before the current one
      borderWidthAfter - defines width of the border that is after the current one
    • drawCellBorder

      public void drawCellBorder (PdfCanvas canvas, float x1, float y1, float x2, float y2, Border.Side defaultSide)
      Draws the border of a cell.
      Specified by:
      drawCellBorder in class Border
      Parameters:
      canvas - PdfCanvas to be written to
      x1 - x coordinate of the beginning point of the element side, that should be bordered
      y1 - y coordinate of the beginning point of the element side, that should be bordered
      x2 - x coordinate of the ending point of the element side, that should be bordered
      y2 - y coordinate of the ending point of the element side, that should be bordered
      defaultSide - the Border.Side, that we will fallback to, if it cannot be determined by border coordinates
    • getType

      public int getType()
      Returns the type of the border
      Specified by:
      getType in class Border
      Returns:
      the type of border.