Table of Contents

Class Underline

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

A POJO that describes the underline of a layout element.

public class Underline
Inheritance
Underline
Inherited Members

Remarks

A POJO that describes the underline of a layout element. This class is to be used as a property for an element or renderer, as the value for UNDERLINE

Constructors

Underline(Color, float, float, float, float, int)

Creates an Underline.

public Underline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)

Parameters

color Color

the Color of the underline

thickness float

a float defining the minimum thickness in points of the underline

thicknessMul float

a float defining the font size dependent component of the thickness of the underline

yPosition float

a float defining the default absolute vertical distance in points from the text's base line

yPositionMul float

a float defining the font size dependent component of the vertical positioning of the underline

lineCapStyle int

the way the underline finishes at its edges. PdfCanvasConstants.LineCapStyle

Remarks

Creates an Underline. Both the thickness and vertical positioning under the text element's base line can be set to a fixed value, or a variable one depending on the element's font size. If you want a fixed-width thickness, set thicknessMul to 0; if you want a thickness solely dependent on the font size, set thickness to 0. Mutatis mutandis for the y-position.

Underline(Color, float, float, float, float, float, int)

Creates an Underline.

public Underline(Color color, float opacity, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)

Parameters

color Color

the Color of the underline

opacity float

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

thickness float

a float defining the minimum thickness in points of the underline

thicknessMul float

a float defining the font size dependent component of the thickness of the underline

yPosition float

a float defining the default absolute vertical distance in points from the text's base line

yPositionMul float

a float defining the font size dependent component of the vertical positioning of the underline

lineCapStyle int

the way the underline finishes at its edges. PdfCanvasConstants.LineCapStyle

Remarks

Creates an Underline. Both the thickness and vertical positioning under the text element's base line can be set to a fixed value, or a variable one depending on the element's font size. If you want a fixed-width thickness, set thicknessMul to 0; if you want a thickness solely dependent on the font size, set thickness to 0. Mutatis mutandis for the y-position.

Fields

lineCapStyle

protected int lineCapStyle

Field Value

int

thickness

protected float thickness

Field Value

float

thicknessMul

protected float thicknessMul

Field Value

float

transparentColor

protected TransparentColor transparentColor

Field Value

TransparentColor

yPosition

protected float yPosition

Field Value

float

yPositionMul

protected float yPositionMul

Field Value

float

Methods

GetColor()

Gets the color of the underline.

public virtual Color GetColor()

Returns

Color

a Color

GetLineCapStyle()

Gets the PdfCanvasConstants.LineCapStyle of the text underline.

public virtual int GetLineCapStyle()

Returns

int

the line cap style, as an int referring to the values of PdfCanvasConstants.LineCapStyle

GetOpacity()

Gets the opacity of the underline color.

public virtual float GetOpacity()

Returns

float

a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent

GetThickness(float)

Gets the total thickness of the underline (fixed + variable part).

public virtual float GetThickness(float fontSize)

Parameters

fontSize float

the font size for which to calculate the variable thickness

Returns

float

the total thickness, as a float, in points

GetYPosition(float)

Gets the vertical position of the underline (fixed + variable part).

public virtual float GetYPosition(float fontSize)

Parameters

fontSize float

the font size for which to calculate the variable position

Returns

float

the y-position, as a float, in points

GetYPositionMul()

Gets the multiplier for the vertical positioning of the text underline.

public virtual float GetYPositionMul()

Returns

float

the Y-position multiplier, as a float