Table of Contents

Class Border

Namespace
iText.Layout.Borders
Assembly
itext.layout.dll

Represents a border.

public abstract class Border
Inheritance
Border
Derived
Inherited Members

Constructors

Border(float)

Creates a border with the given width.

protected Border(float width)

Parameters

width float

the width which the border should have

Remarks

Creates a border with the given width. The color to be set by default is black

Border(Color, float)

Creates a border with given width and color.

protected Border(Color color, float width)

Parameters

color Color

the color which the border should have

width float

the width which the border should have

Border(Color, float, float)

Creates a border with given width, color and opacity.

protected Border(Color color, float width, float opacity)

Parameters

color Color

the color which the border should have

width float

the width which the border should have

opacity float

the opacity which border should have; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent

Fields

DASHED

The dashed border.

public const int DASHED = 1

Field Value

int
See Also

DASHED_FIXED

The fixed dashed border.

public const int DASHED_FIXED = 9

Field Value

int
See Also

DOTTED

The dotted border.

public const int DOTTED = 2

Field Value

int
See Also

DOUBLE

The double border.

public const int DOUBLE = 3

Field Value

int
See Also

NO_BORDER

The null Border, i.e. the presence of such border is equivalent to the absence of the border

public static readonly Border NO_BORDER

Field Value

Border

ROUND_DOTS

The round-dots border.

public const int ROUND_DOTS = 4

Field Value

int
See Also

SOLID

The solid border.

public const int SOLID = 0

Field Value

int
See Also

_3D_GROOVE

The 3D groove border.

public const int _3D_GROOVE = 5

Field Value

int
See Also

_3D_INSET

The 3D inset border.

public const int _3D_INSET = 6

Field Value

int
See Also

_3D_OUTSET

The 3D outset border.

public const int _3D_OUTSET = 7

Field Value

int
See Also

_3D_RIDGE

The 3D ridge border.

public const int _3D_RIDGE = 8

Field Value

int
See Also

transparentColor

The color of the border.

protected TransparentColor transparentColor

Field Value

TransparentColor
See Also

type

The type of the border.

protected int type

Field Value

int

width

The width of the border.

protected float width

Field Value

float

Methods

Draw(PdfCanvas, float, float, float, float, float, float, float, float, Side, float, float)

All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction.

public virtual 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)

Parameters

canvas PdfCanvas

PdfCanvas to be written to

x1 float

x coordinate of the beginning point of the element side, that should be bordered

y1 float

y coordinate of the beginning point of the element side, that should be bordered

x2 float

x coordinate of the ending point of the element side, that should be bordered

y2 float

y coordinate of the ending point of the element side, that should be bordered

horizontalRadius1 float

defines the horizontal radius of the border's first corner

verticalRadius1 float

defines the vertical radius of the border's first corner

horizontalRadius2 float

defines the horizontal radius of the border's second corner

verticalRadius2 float

defines the vertical radius of the border's second corner

defaultSide Border.Side

the Border.Side , that we will fallback to, if it cannot be determined by border coordinates

borderWidthBefore float

defines width of the border that is before the current one

borderWidthAfter float

defines width of the border that is after the current one

Remarks

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.

Draw(PdfCanvas, float, float, float, float, float, Side, float, float)

All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction.

public virtual void Draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, float borderRadius, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)

Parameters

canvas PdfCanvas

PdfCanvas to be written to

x1 float

x coordinate of the beginning point of the element side, that should be bordered

y1 float

y coordinate of the beginning point of the element side, that should be bordered

x2 float

x coordinate of the ending point of the element side, that should be bordered

y2 float

y coordinate of the ending point of the element side, that should be bordered

borderRadius float

defines the radius of the element's corners

defaultSide Border.Side

the Border.Side , that we will fallback to, if it cannot be determined by border coordinates

borderWidthBefore float

defines width of the border that is before the current one

borderWidthAfter float

defines width of the border that is after the current one

Remarks

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.

borderRadius is used to draw rounded borders.

Draw(PdfCanvas, float, float, float, float, Side, float, float)

All borders are supposed to be drawn in such way, that inner content of the element is on the right from the drawing direction.

public abstract void Draw(PdfCanvas canvas, float x1, float y1, float x2, float y2, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)

Parameters

canvas PdfCanvas

PdfCanvas to be written to

x1 float

x coordinate of the beginning point of the element side, that should be bordered

y1 float

y coordinate of the beginning point of the element side, that should be bordered

x2 float

x coordinate of the ending point of the element side, that should be bordered

y2 float

y coordinate of the ending point of the element side, that should be bordered

defaultSide Border.Side

the Border.Side , that we will fallback to, if it cannot be determined by border coordinates

borderWidthBefore float

defines width of the border that is before the current one

borderWidthAfter float

defines width of the border that is after the current one

Remarks

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.

Draw(PdfCanvas, Rectangle)

Draw borders around the target rectangle.

public virtual void Draw(PdfCanvas canvas, Rectangle rectangle)

Parameters

canvas PdfCanvas

PdfCanvas to be written to

rectangle Rectangle

border positions rectangle

DrawCellBorder(PdfCanvas, float, float, float, float, Side)

Draws the border of a cell.

public abstract void DrawCellBorder(PdfCanvas canvas, float x1, float y1, float x2, float y2, Border.Side defaultSide)

Parameters

canvas PdfCanvas

PdfCanvas to be written to

x1 float

x coordinate of the beginning point of the element side, that should be bordered

y1 float

y coordinate of the beginning point of the element side, that should be bordered

x2 float

x coordinate of the ending point of the element side, that should be bordered

y2 float

y coordinate of the ending point of the element side, that should be bordered

defaultSide Border.Side

the Border.Side , that we will fallback to, if it cannot be determined by border coordinates

DrawDiscontinuousBorders(PdfCanvas, Rectangle, float[], float[], Side, float, float)

Perform drawing operations to draw discontinuous borders.

protected virtual void DrawDiscontinuousBorders(PdfCanvas canvas, Rectangle boundingRectangle, float[] horizontalRadii, float[] verticalRadii, Border.Side defaultSide, float borderWidthBefore, float borderWidthAfter)

Parameters

canvas PdfCanvas

canvas to draw on

boundingRectangle Rectangle

rectangle representing the bounding box of the drawing operations

horizontalRadii float[]

the horizontal radius of the border's two corners

verticalRadii float[]

the vertical radius of the border's two corners

defaultSide Border.Side

the Border.Side , that we will fallback to, if it cannot be determined by border coordinates

borderWidthBefore float

defines width of the border that is before the current one

borderWidthAfter float

defines width of the border that is after the current one

Remarks

Perform drawing operations to draw discontinuous borders. Used by DashedBorder , DottedBorder and RoundDotsBorder.

Equals(object)

Indicates whether the border is equal to the given border.

public override bool Equals(object anObject)

Parameters

anObject object

Returns

bool

Remarks

Indicates whether the border is equal to the given border. The border type, width and color are considered during the comparison.

GetBorderSide(float, float, float, float, Side)

Returns the side corresponded to the line between two points.

protected virtual Border.Side GetBorderSide(float x1, float y1, float x2, float y2, Border.Side defaultSide)

Parameters

x1 float

the abscissa of the left-bottom point

y1 float

the ordinate of the left-bottom point

x2 float

the abscissa of the right-top point

y2 float

the ordinate of the right-top point

defaultSide Border.Side

the default side of border

Returns

Border.Side

the corresponded side

Remarks

Returns the side corresponded to the line between two points. Notice that we consider the rectangle traversal to be clockwise. In case side couldn't be detected we will fallback to default side

GetBorderType()

Returns the type of the border

public abstract int GetBorderType()

Returns

int

the type of border.

GetColor()

Gets the color of the border

public virtual Color GetColor()

Returns

Color

the color

GetDotsGap(double, float)

Adjusts the size of the gap between dots

protected virtual float GetDotsGap(double distance, float initialGap)

Parameters

distance double

the border length

initialGap float

the initial size of the gap

Returns

float

the adjusted size of the gap

GetHashCode()

public override int GetHashCode()

Returns

int

GetIntersectionPoint(Point, Point, Point, Point)

Gets a Point in which two lines intersect.

protected virtual Point GetIntersectionPoint(Point lineBeg, Point lineEnd, Point clipLineBeg, Point clipLineEnd)

Parameters

lineBeg Point

a Point which defines some point on the first line

lineEnd Point

a Point which defines another point on the first line

clipLineBeg Point

a Point which defines some point on the second line

clipLineEnd Point

a Point which defines another point on the second line

Returns

Point

the intersection Point

GetOpacity()

Gets the opacity of the border

public virtual float GetOpacity()

Returns

float

the border opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent

GetStartingPointsForBorderSide(float, float, float, float, Side)

Calculate adjusted starting points for discontinuous borders, given two opposing points (A and B) that define the bounding rectangle

protected virtual float[] GetStartingPointsForBorderSide(float x1, float y1, float x2, float y2, Border.Side defaultSide)

Parameters

x1 float

x-coordinate of point A

y1 float

y-ordinate of point A

x2 float

x-coordinate of point B

y2 float

y-ordinate of point B

defaultSide Border.Side

default side of the border used to determine the side given by points A and B

Returns

float[]

float[] containing the adjusted starting points in the form {x1,y1,x2,y2}

GetWidth()

Gets the width of the border

public virtual float GetWidth()

Returns

float

the width

SetColor(Color)

Sets the color of the border

public virtual void SetColor(Color color)

Parameters

color Color

The color

SetWidth(float)

Sets the width of the border

public virtual void SetWidth(float width)

Parameters

width float

The width