iText 9.1.0 API
All Classes Namespaces Functions Variables Enumerations Enumerator Properties
iText.Layout.Properties.Underline Class Reference

A POJO that describes the underline of a layout element. More...

Public Member Functions

  Underline (Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)
  Creates an Underline. More...
 
  Underline (Color color, float opacity, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)
  Creates an Underline. More...
 
virtual Color  GetColor ()
  Gets the color of the underline. More...
 
virtual float  GetOpacity ()
  Gets the opacity of the underline color. More...
 
virtual float  GetThickness (float fontSize)
  Gets the total thickness of the underline (fixed + variable part). More...
 
virtual float  GetYPosition (float fontSize)
  Gets the vertical position of the underline (fixed + variable part). More...
 
virtual float  GetYPositionMul ()
  Gets the multiplier for the vertical positioning of the text underline. More...
 
virtual int  GetLineCapStyle ()
  Gets the iText.Kernel.Pdf.Canvas.PdfCanvasConstants.LineCapStyle of the text underline. More...
 
virtual TransparentColor  GetStrokeColor ()
  Gets the color of the underline stroke. More...
 
virtual iText.Layout.Properties.Underline  SetStrokeColor (TransparentColor strokeColor)
  Sets the stroke color of the underline. More...
 
virtual float  GetStrokeWidth ()
  Gets the thickness of the underline stroke. More...
 
virtual iText.Layout.Properties.Underline  SetStrokeWidth (float strokeWidth)
  Sets the thickness of the underline stroke. More...
 
virtual float[]  GetDashArray ()
  Gets dash array part of the dash pattern to be used when paths are stroked. More...
 
virtual float  GetDashPhase ()
  Gets dash phase part of the dash pattern to be used when paths are stroked. More...
 
virtual iText.Layout.Properties.Underline  SetDashPattern (float[] dashArray, float dashPhase)
  Sets a description of the dash pattern to be used when paths are stroked. More...
 

Package Attributes

TransparentColor  transparentColor
 
float  thickness
 
float  thicknessMul
 
float  yPosition
 
float  yPositionMul
 
int  lineCapStyle = PdfCanvasConstants.LineCapStyle.BUTT
 

Detailed Description

A POJO that describes the underline of a layout element.

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 Property.UNDERLINE.

Constructor & Destructor Documentation

◆ Underline() [1/2]

iText.Layout.Properties.Underline.Underline ( Color  color,
float  thickness,
float  thicknessMul,
float  yPosition,
float  yPositionMul,
int  lineCapStyle 
)
inline

Creates an Underline.

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.

Parameters
color the iText.Kernel.Colors.Color of the underline
thickness a float defining the minimum thickness in points of the underline
thicknessMul a float defining the font size dependent component of the thickness of the underline
yPosition a float defining the default absolute vertical distance in points from the text's base line
yPositionMul a float defining the font size dependent component of the vertical positioning of the underline
lineCapStyle the way the underline finishes at its edges. iText.Kernel.Pdf.Canvas.PdfCanvasConstants.LineCapStyle

◆ Underline() [2/2]

iText.Layout.Properties.Underline.Underline ( Color  color,
float  opacity,
float  thickness,
float  thicknessMul,
float  yPosition,
float  yPositionMul,
int  lineCapStyle 
)
inline

Creates an Underline.

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.

Parameters
color the iText.Kernel.Colors.Color of the underline
opacity 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 a float defining the minimum thickness in points of the underline
thicknessMul a float defining the font size dependent component of the thickness of the underline
yPosition a float defining the default absolute vertical distance in points from the text's base line
yPositionMul a float defining the font size dependent component of the vertical positioning of the underline
lineCapStyle the way the underline finishes at its edges. iText.Kernel.Pdf.Canvas.PdfCanvasConstants.LineCapStyle

Member Function Documentation

◆ GetColor()

virtual Color iText.Layout.Properties.Underline.GetColor ( )
inlinevirtual

Gets the color of the underline.

Returns
a iText.Kernel.Colors.Color

◆ GetDashArray()

virtual float [] iText.Layout.Properties.Underline.GetDashArray ( )
inlinevirtual

Gets dash array part of the dash pattern to be used when paths are stroked.

Gets dash array part of the dash pattern to be used when paths are stroked. Default value is solid line.

The line dash pattern is expressed as an array of the form [ dashArray dashPhase ], where dashArray is itself an array and dashPhase is an integer.

An empty dash array (first element in the array) and zero phase (second element in the array) can be used to restore the dash pattern to a solid line.

Returns
float dash array

◆ GetDashPhase()

virtual float iText.Layout.Properties.Underline.GetDashPhase ( )
inlinevirtual

Gets dash phase part of the dash pattern to be used when paths are stroked.

Gets dash phase part of the dash pattern to be used when paths are stroked. Default value is solid line.

The line dash pattern is expressed as an array of the form [ dashArray dashPhase ], where dashArray is itself an array and dashPhase is an integer.

An empty dash array (first element in the array) and zero phase (second element in the array) can be used to restore the dash pattern to a solid line.

Returns
float dash array

◆ GetLineCapStyle()

virtual int iText.Layout.Properties.Underline.GetLineCapStyle ( )
inlinevirtual

Gets the iText.Kernel.Pdf.Canvas.PdfCanvasConstants.LineCapStyle of the text underline.

Returns
the line cap style, as an int referring to the values of iText.Kernel.Pdf.Canvas.PdfCanvasConstants.LineCapStyle

◆ GetOpacity()

virtual float iText.Layout.Properties.Underline.GetOpacity ( )
inlinevirtual

Gets the opacity of the underline color.

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

◆ GetStrokeColor()

virtual TransparentColor iText.Layout.Properties.Underline.GetStrokeColor ( )
inlinevirtual

Gets the color of the underline stroke.

Returns

TransparentColor stroke color

◆ GetStrokeWidth()

virtual float iText.Layout.Properties.Underline.GetStrokeWidth ( )
inlinevirtual

Gets the thickness of the underline stroke.

Returns
float value of the stroke width

◆ GetThickness()

virtual float iText.Layout.Properties.Underline.GetThickness ( float  fontSize )
inlinevirtual

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

Parameters
fontSize the font size for which to calculate the variable thickness
Returns
the total thickness, as a float, in points

◆ GetYPosition()

virtual float iText.Layout.Properties.Underline.GetYPosition ( float  fontSize )
inlinevirtual

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

Parameters
fontSize the font size for which to calculate the variable position
Returns
the y-position, as a float, in points

◆ GetYPositionMul()

virtual float iText.Layout.Properties.Underline.GetYPositionMul ( )
inlinevirtual

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

Returns
the Y-position multiplier, as a float

◆ SetDashPattern()

virtual iText.Layout.Properties.Underline iText.Layout.Properties.Underline.SetDashPattern ( float[]  dashArray,
float  dashPhase 
)
inlinevirtual

Sets a description of the dash pattern to be used when paths are stroked.

Sets a description of the dash pattern to be used when paths are stroked. Default value is solid line.

The line dash pattern is expressed as an array of the form [ dashArray dashPhase ], where dashArray is itself an array and dashPhase is a number.

An empty dash array (first element in the array) and zero phase (second element in the array) can be used to restore the dash pattern to a solid line.

Parameters
dashArray dash array
dashPhase dash phase value
Returns
this same Underline instance

◆ SetStrokeColor()

virtual iText.Layout.Properties.Underline iText.Layout.Properties.Underline.SetStrokeColor ( TransparentColor  strokeColor )
inlinevirtual

Sets the stroke color of the underline.

Parameters
strokeColor

TransparentColor stroke color

Returns
this Underline instance

◆ SetStrokeWidth()

virtual iText.Layout.Properties.Underline iText.Layout.Properties.Underline.SetStrokeWidth ( float  strokeWidth )
inlinevirtual

Sets the thickness of the underline stroke.

Parameters
strokeWidth float value of the stroke width
Returns
this Underline instance