iText 9.0.0 API
iText.Layout.Style Class Reference

Container object for style properties of an element. More...

Inheritance diagram for iText.Layout.Style:
iText.Layout.ElementPropertyContainer< iText.Layout.Style >

Public Member Functions

  Style (iText.Layout.Style style)
 
virtual UnitValue  GetMarginLeft ()
  Gets the current left margin width of the element. More...
 
virtual iText.Layout.Style  SetMarginLeft (float value)
  Sets the left margin width of the element. More...
 
virtual UnitValue  GetMarginRight ()
  Gets the current right margin width of the element. More...
 
virtual iText.Layout.Style  SetMarginRight (float value)
  Sets the right margin width of the element. More...
 
virtual UnitValue  GetMarginTop ()
  Gets the current top margin width of the element. More...
 
virtual iText.Layout.Style  SetMarginTop (float value)
  Sets the top margin width of the element. More...
 
virtual UnitValue  GetMarginBottom ()
  Gets the current bottom margin width of the element. More...
 
virtual iText.Layout.Style  SetMarginBottom (float value)
  Sets the bottom margin width of the element. More...
 
virtual iText.Layout.Style  SetMargin (float commonMargin)
  Sets all margins around the element to the same width. More...
 
virtual iText.Layout.Style  SetMargins (float marginTop, float marginRight, float marginBottom, float marginLeft)
  Sets the margins around the element to a series of new widths. More...
 
virtual UnitValue  GetPaddingLeft ()
  Gets the current left padding width of the element. More...
 
virtual iText.Layout.Style  SetPaddingLeft (float value)
  Sets the left padding width of the element. More...
 
virtual UnitValue  GetPaddingRight ()
  Gets the current right padding width of the element. More...
 
virtual iText.Layout.Style  SetPaddingRight (float value)
  Sets the right padding width of the element. More...
 
virtual UnitValue  GetPaddingTop ()
  Gets the current top padding width of the element. More...
 
virtual iText.Layout.Style  SetPaddingTop (float value)
  Sets the top padding width of the element. More...
 
virtual UnitValue  GetPaddingBottom ()
  Gets the current bottom padding width of the element. More...
 
virtual iText.Layout.Style  SetPaddingBottom (float value)
  Sets the bottom padding width of the element. More...
 
virtual iText.Layout.Style  SetPadding (float commonPadding)
  Sets all paddings around the element to the same width. More...
 
virtual iText.Layout.Style  SetPaddings (float paddingTop, float paddingRight, float paddingBottom, float paddingLeft)
  Sets the paddings around the element to a series of new widths. More...
 
virtual iText.Layout.Style  SetVerticalAlignment (VerticalAlignment? verticalAlignment)
  Sets the vertical alignment of the element. More...
 
virtual iText.Layout.Style  SetSpacingRatio (float ratio)
  Sets a ratio which determines in which proportion will word spacing and character spacing be applied when horizontal alignment is justified. More...
 
virtual ? bool  IsKeepTogether ()
  Returns whether the iText.Layout.Element.BlockElement should be kept together as much as possible. More...
 
virtual iText.Layout.Style  SetKeepTogether (bool keepTogether)
  Sets whether the iText.Layout.Element.BlockElement should be kept together as much as possible. More...
 
virtual iText.Layout.Style  SetRotationAngle (float radAngle)
  Sets the rotation radAngle. More...
 
virtual iText.Layout.Style  SetRotationAngle (double angle)
  Sets the rotation angle. More...
 
virtual iText.Layout.Style  SetWidth (float width)
  Sets the width property of the element, measured in points. More...
 
virtual iText.Layout.Style  SetWidth (UnitValue width)
  Sets the width property of the element with a iText.Layout.Properties.UnitValue. More...
 
virtual UnitValue  GetWidth ()
  Gets the width property of the element. More...
 
virtual iText.Layout.Style  SetHeight (UnitValue height)
  Sets the height property of the element with a iText.Layout.Properties.UnitValue. More...
 
virtual iText.Layout.Style  SetHeight (float height)
  Sets the height property the element as a point-value. More...
 
virtual UnitValue  GetHeight ()
  Gets the height property of the element. More...
 
virtual iText.Layout.Style  SetMaxHeight (float maxHeight)
  Sets the max-height of the element as point-unit value. More...
 
virtual iText.Layout.Style  SetMaxHeight (UnitValue maxHeight)
  Sets the max-height property of the element with a iText.Layout.Properties.UnitValue. More...
 
virtual iText.Layout.Style  SetMinHeight (UnitValue minHeight)
  Sets the min-height property of the element with a iText.Layout.Properties.UnitValue. More...
 
virtual iText.Layout.Style  SetMinHeight (float minHeight)
  Sets the min-height of the element as point-unit value. More...
 
virtual iText.Layout.Style  SetMaxWidth (UnitValue maxWidth)
  Sets the max-width property of the element with a iText.Layout.Properties.UnitValue. More...
 
virtual iText.Layout.Style  SetMaxWidth (float maxWidth)
  Sets the max-width of the element as point-unit value. More...
 
virtual iText.Layout.Style  SetMinWidth (UnitValue minWidth)
  Sets the min-width property of the element with a iText.Layout.Properties.UnitValue. More...
 
virtual iText.Layout.Style  SetMinWidth (float minWidth)
  Sets the min-width of the element as point-unit value. More...
 
- Public Member Functions inherited from iText.Layout.ElementPropertyContainer< iText.Layout.Style >
virtual void  SetProperty (int property, Object value)
  Sets a property for this entity. More...
 
virtual bool  HasProperty (int property)
  Checks if this entity has the specified property. More...
 
virtual bool  HasOwnProperty (int property)
  Checks if this entity has the specified property, i.e. if it was set to this very element earlier More...
 
virtual void  DeleteOwnProperty (int property)
  Deletes the own property of this entity. More...
 
virtual T1  GetProperty< T1 > (int property)
  Gets the property from this entity. More...
 
virtual T1  GetOwnProperty< T1 > (int property)
  Gets own property from this entity. More...
 
virtual T1  GetDefaultProperty< T1 > (int property)
  Gets the default property from this entity. More...
 
virtual T  SetRelativePosition (float left, float top, float right, float bottom)
  Sets values for a relative repositioning of the Element. More...
 
virtual T  SetFixedPosition (float left, float bottom, float width)
  Sets values for a absolute repositioning of the Element. More...
 
virtual T  SetFixedPosition (float left, float bottom, UnitValue width)
  Sets values for an absolute repositioning of the Element. More...
 
virtual T  SetFixedPosition (int pageNumber, float left, float bottom, float width)
  Sets values for a absolute repositioning of the Element. More...
 
virtual T  SetFixedPosition (int pageNumber, float left, float bottom, UnitValue width)
  Sets values for a absolute repositioning of the Element. More...
 
virtual T  SetHorizontalAlignment (HorizontalAlignment? horizontalAlignment)
  Sets the horizontal alignment of this Element. More...
 
virtual T  SetFont (PdfFont font)
  Sets the font of this Element. More...
 
virtual T  SetFontFamily (params String[] fontFamilyNames)
  Sets the preferable font families for this Element. More...
 
virtual T  SetFontFamily (IList< String > fontFamilyNames)
  Sets the preferable font families for this Element. More...
 
virtual T  SetFontColor (Color fontColor)
  Sets the font color of this Element. More...
 
virtual T  SetFontColor (Color fontColor, float opacity)
  Sets the font color of this Element and the opacity of the text. More...
 
virtual T  SetFontColor (TransparentColor transparentColor)
 
virtual T  SetFontSize (float fontSize)
  Sets the font size of this Element, measured in points. More...
 
virtual T  SetTextAlignment (TextAlignment? alignment)
  Sets the text alignment of this Element. More...
 
virtual T  SetCharacterSpacing (float charSpacing)
  Defines a custom spacing distance between all characters of a textual element. More...
 
virtual T  SetWordSpacing (float wordSpacing)
  Defines a custom spacing distance between words of a textual element. More...
 
virtual T  SetFontKerning (FontKerning fontKerning)
  Enable or disable kerning. More...
 
virtual T  SetBackgroundColor (Color backgroundColor)
  Specifies a background color for the Element. More...
 
virtual T  SetBackgroundColor (Color backgroundColor, float opacity)
  Specifies a background color for the Element. More...
 
virtual T  SetBackgroundColor (Color backgroundColor, float extraLeft, float extraTop, float extraRight, float extraBottom)
  Specifies a background color for the Element, and extra space that must be counted as part of the background and therefore colored. More...
 
virtual T  SetBackgroundColor (Color backgroundColor, float opacity, float extraLeft, float extraTop, float extraRight, float extraBottom)
  Specifies a background color for the Element, and extra space that must be counted as part of the background and therefore colored. More...
 
virtual T  SetBackgroundImage (BackgroundImage image)
  Specifies a background image for the Element. More...
 
virtual T  SetBackgroundImage (IList< BackgroundImage > imagesList)
  Specifies a list of background images for the Element. More...
 
virtual T  SetBorder (Border border)
  Sets a border for all four edges of this Element with customizable color, width, pattern type. More...
 
virtual T  SetBorderTop (Border border)
  Sets a border for the upper limit of this Element with customizable color, width, pattern type. More...
 
virtual T  SetBorderRight (Border border)
  Sets a border for the right limit of this Element with customizable color, width, pattern type. More...
 
virtual T  SetBorderBottom (Border border)
  Sets a border for the bottom limit of this Element with customizable color, width, pattern type. More...
 
virtual T  SetBorderLeft (Border border)
  Sets a border for the left limit of this Element with customizable color, width, pattern type. More...
 
virtual T  SetBorderRadius (BorderRadius borderRadius)
  Sets a border radius for all four edges of this Element. More...
 
virtual T  SetBorderBottomLeftRadius (BorderRadius borderRadius)
  Sets a border radius for the bottom left corner of this Element. More...
 
virtual T  SetBorderBottomRightRadius (BorderRadius borderRadius)
  Sets a border radius for the bottom right corner of this Element. More...
 
virtual T  SetBorderTopLeftRadius (BorderRadius borderRadius)
  Sets a border radius for the top left corner of this Element. More...
 
virtual T  SetBorderTopRightRadius (BorderRadius borderRadius)
  Sets a border radius for the top right corner of this Element. More...
 
virtual T  SetSplitCharacters (ISplitCharacters splitCharacters)
  Sets a rule for splitting strings when they don't fit into one line. More...
 
virtual ISplitCharacters  GetSplitCharacters ()
  Gets a rule for splitting strings when they don't fit into one line. More...
 
virtual ? int  GetTextRenderingMode ()
  Gets the text rendering mode, a variable that determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three. More...
 
virtual T  SetTextRenderingMode (int textRenderingMode)
  Sets the text rendering mode, a variable that determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three. More...
 
virtual Color  GetStrokeColor ()
  Gets the stroke color for the current element. More...
 
virtual T  SetStrokeColor (Color strokeColor)
  Sets the stroke color for the current element. More...
 
virtual ? float  GetStrokeWidth ()
  Gets the stroke width for the current element. More...
 
virtual T  SetStrokeWidth (float strokeWidth)
  Sets the stroke width for the current element. More...
 
virtual T  SimulateBold ()
  Simulates bold style for a font. More...
 
virtual T  SimulateItalic ()
  Simulates italic style for a font. More...
 
virtual T  SetLineThrough ()
  Sets default line-through attributes for text. More...
 
virtual T  SetUnderline ()
  Sets default underline attributes for text. More...
 
virtual T  SetUnderline (float thickness, float yPosition)
  Sets an horizontal line that can be an underline or a strikethrough. More...
 
virtual T  SetUnderline (Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)
  Sets an horizontal line that can be an underline or a strikethrough. More...
 
virtual T  SetUnderline (Color color, float opacity, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)
  Sets an horizontal line that can be an underline or a strikethrough. More...
 
virtual T  SetBaseDirection (BaseDirection? baseDirection)
  This attribute specifies the base direction of directionally neutral text (i.e., text that doesn't have inherent directionality as defined in Unicode) in an element's content and attribute values. More...
 
virtual T  SetHyphenation (HyphenationConfig hyphenationConfig)
  Sets a custom hyphenation configuration which will hyphenate words automatically accordingly to the language and country. More...
 
virtual T  SetFontScript (UnicodeScript? script)
  Sets the writing system for this text element. More...
 
virtual T  SetDestination (String destination)
  Sets a destination name that will be created when this element is drawn to content. More...
 
virtual T  SetOpacity (float? opacity)
  Sets an opacity of the given element. More...
 

Additional Inherited Members

- Package Attributes inherited from iText.Layout.ElementPropertyContainer< iText.Layout.Style >
IDictionary< int, Object >  properties
 

Detailed Description

Container object for style properties of an element.

Container object for style properties of an element. A style can be used as an effective way to define multiple equal properties to several elements. Used in iText.Layout.Element.AbstractElement. The properties set via Style have a lower priority than directly set properties. For example, if the same property is set directly and added via Style, then, no matter in which order they are set, the one set directly will be chosen.

Member Function Documentation

◆ GetHeight()

virtual UnitValue iText.Layout.Style.GetHeight ( )
inlinevirtual

Gets the height property of the element.

Returns
the height of the element, as a floating point value. Null if the property is not present

◆ GetMarginBottom()

virtual UnitValue iText.Layout.Style.GetMarginBottom ( )
inlinevirtual

Gets the current bottom margin width of the element.

Returns
the bottom margin width, as a iText.Layout.Properties.UnitValue object

◆ GetMarginLeft()

virtual UnitValue iText.Layout.Style.GetMarginLeft ( )
inlinevirtual

Gets the current left margin width of the element.

Returns
the left margin width, as a iText.Layout.Properties.UnitValue object

◆ GetMarginRight()

virtual UnitValue iText.Layout.Style.GetMarginRight ( )
inlinevirtual

Gets the current right margin width of the element.

Returns
the right margin width, as a iText.Layout.Properties.UnitValue object

◆ GetMarginTop()

virtual UnitValue iText.Layout.Style.GetMarginTop ( )
inlinevirtual

Gets the current top margin width of the element.

Returns
the top margin width, as a iText.Layout.Properties.UnitValue object

◆ GetPaddingBottom()

virtual UnitValue iText.Layout.Style.GetPaddingBottom ( )
inlinevirtual

Gets the current bottom padding width of the element.

Returns
the bottom padding width, as a iText.Layout.Properties.UnitValue object

◆ GetPaddingLeft()

virtual UnitValue iText.Layout.Style.GetPaddingLeft ( )
inlinevirtual

Gets the current left padding width of the element.

Returns
the left padding width, as a iText.Layout.Properties.UnitValue object

◆ GetPaddingRight()

virtual UnitValue iText.Layout.Style.GetPaddingRight ( )
inlinevirtual

Gets the current right padding width of the element.

Returns
the right padding width, as a iText.Layout.Properties.UnitValue object

◆ GetPaddingTop()

virtual UnitValue iText.Layout.Style.GetPaddingTop ( )
inlinevirtual

Gets the current top padding width of the element.

Returns
the top padding width, as a iText.Layout.Properties.UnitValue object

◆ GetWidth()

virtual UnitValue iText.Layout.Style.GetWidth ( )
inlinevirtual

Gets the width property of the element.

Returns
the width of the element, with a value and a measurement unit.
See also
iText.Layout.Properties.UnitValue

◆ IsKeepTogether()

virtual ? bool iText.Layout.Style.IsKeepTogether ( )
inlinevirtual

Returns whether the iText.Layout.Element.BlockElement should be kept together as much as possible.

Returns
the current value of the iText.Layout.Properties.Property.KEEP_TOGETHER property

◆ SetHeight() [1/2]

virtual iText.Layout.Style iText.Layout.Style.SetHeight ( float  height )
inlinevirtual

Sets the height property the element as a point-value.

Parameters
height a floating point value for the new height
Returns
the block element itself.

◆ SetHeight() [2/2]

virtual iText.Layout.Style iText.Layout.Style.SetHeight ( UnitValue  height )
inlinevirtual

Sets the height property of the element with a iText.Layout.Properties.UnitValue.

Parameters
height a iText.Layout.Properties.UnitValue object
Returns
this Element.

◆ SetKeepTogether()

virtual iText.Layout.Style iText.Layout.Style.SetKeepTogether ( bool  keepTogether )
inlinevirtual

Sets whether the iText.Layout.Element.BlockElement should be kept together as much as possible.

Parameters
keepTogether the new value of the iText.Layout.Properties.Property.KEEP_TOGETHER property
Returns
this element

◆ SetMargin()

virtual iText.Layout.Style iText.Layout.Style.SetMargin ( float  commonMargin )
inlinevirtual

Sets all margins around the element to the same width.

Parameters
commonMargin the new margin width
Returns
this element

◆ SetMarginBottom()

virtual iText.Layout.Style iText.Layout.Style.SetMarginBottom ( float  value )
inlinevirtual

Sets the bottom margin width of the element.

Parameters
value the new bottom margin width
Returns
this element

◆ SetMarginLeft()

virtual iText.Layout.Style iText.Layout.Style.SetMarginLeft ( float  value )
inlinevirtual

Sets the left margin width of the element.

Parameters
value the new left margin width
Returns
this element

◆ SetMarginRight()

virtual iText.Layout.Style iText.Layout.Style.SetMarginRight ( float  value )
inlinevirtual

Sets the right margin width of the element.

Parameters
value the new right margin width
Returns
this element

◆ SetMargins()

virtual iText.Layout.Style iText.Layout.Style.SetMargins ( float  marginTop,
float  marginRight,
float  marginBottom,
float  marginLeft 
)
inlinevirtual

Sets the margins around the element to a series of new widths.

Parameters
marginTop the new margin top width
marginRight the new margin right width
marginBottom the new margin bottom width
marginLeft the new margin left width
Returns
this element

◆ SetMarginTop()

virtual iText.Layout.Style iText.Layout.Style.SetMarginTop ( float  value )
inlinevirtual

Sets the top margin width of the element.

Parameters
value the new top margin width
Returns
this element

◆ SetMaxHeight() [1/2]

virtual iText.Layout.Style iText.Layout.Style.SetMaxHeight ( float  maxHeight )
inlinevirtual

Sets the max-height of the element as point-unit value.

Parameters
maxHeight a floating point value for the new max-height
Returns
the block element itself

◆ SetMaxHeight() [2/2]

virtual iText.Layout.Style iText.Layout.Style.SetMaxHeight ( UnitValue  maxHeight )
inlinevirtual

Sets the max-height property of the element with a iText.Layout.Properties.UnitValue.

Parameters
maxHeight a iText.Layout.Properties.UnitValue object
Returns
the block element itself

◆ SetMaxWidth() [1/2]

virtual iText.Layout.Style iText.Layout.Style.SetMaxWidth ( float  maxWidth )
inlinevirtual

Sets the max-width of the element as point-unit value.

Parameters
maxWidth a floating point value for the new max-width
Returns
the block element itself

◆ SetMaxWidth() [2/2]

virtual iText.Layout.Style iText.Layout.Style.SetMaxWidth ( UnitValue  maxWidth )
inlinevirtual

Sets the max-width property of the element with a iText.Layout.Properties.UnitValue.

Parameters
maxWidth a iText.Layout.Properties.UnitValue object
Returns
the block element itself

◆ SetMinHeight() [1/2]

virtual iText.Layout.Style iText.Layout.Style.SetMinHeight ( float  minHeight )
inlinevirtual

Sets the min-height of the element as point-unit value.

Parameters
minHeight a floating point value for the new min-height
Returns
the block element itself

◆ SetMinHeight() [2/2]

virtual iText.Layout.Style iText.Layout.Style.SetMinHeight ( UnitValue  minHeight )
inlinevirtual

Sets the min-height property of the element with a iText.Layout.Properties.UnitValue.

Parameters
minHeight a iText.Layout.Properties.UnitValue object
Returns
the block element itself

◆ SetMinWidth() [1/2]

virtual iText.Layout.Style iText.Layout.Style.SetMinWidth ( float  minWidth )
inlinevirtual

Sets the min-width of the element as point-unit value.

Parameters
minWidth a floating point value for the new min-width
Returns
the block element itself

◆ SetMinWidth() [2/2]

virtual iText.Layout.Style iText.Layout.Style.SetMinWidth ( UnitValue  minWidth )
inlinevirtual

Sets the min-width property of the element with a iText.Layout.Properties.UnitValue.

Parameters
minWidth a iText.Layout.Properties.UnitValue object
Returns
the block element itself

◆ SetPadding()

virtual iText.Layout.Style iText.Layout.Style.SetPadding ( float  commonPadding )
inlinevirtual

Sets all paddings around the element to the same width.

Parameters
commonPadding the new padding width
Returns
this element

◆ SetPaddingBottom()

virtual iText.Layout.Style iText.Layout.Style.SetPaddingBottom ( float  value )
inlinevirtual

Sets the bottom padding width of the element.

Parameters
value the new bottom padding width
Returns
this element

◆ SetPaddingLeft()

virtual iText.Layout.Style iText.Layout.Style.SetPaddingLeft ( float  value )
inlinevirtual

Sets the left padding width of the element.

Parameters
value the new left padding width
Returns
this element

◆ SetPaddingRight()

virtual iText.Layout.Style iText.Layout.Style.SetPaddingRight ( float  value )
inlinevirtual

Sets the right padding width of the element.

Parameters
value the new right padding width
Returns
this element

◆ SetPaddings()

virtual iText.Layout.Style iText.Layout.Style.SetPaddings ( float  paddingTop,
float  paddingRight,
float  paddingBottom,
float  paddingLeft 
)
inlinevirtual

Sets the paddings around the element to a series of new widths.

Parameters
paddingTop the new padding top width
paddingRight the new padding right width
paddingBottom the new padding bottom width
paddingLeft the new padding left width
Returns
this element

◆ SetPaddingTop()

virtual iText.Layout.Style iText.Layout.Style.SetPaddingTop ( float  value )
inlinevirtual

Sets the top padding width of the element.

Parameters
value the new top padding width
Returns
this element

◆ SetRotationAngle() [1/2]

virtual iText.Layout.Style iText.Layout.Style.SetRotationAngle ( double  angle )
inlinevirtual

Sets the rotation angle.

Parameters
angle the new rotation angle, as a double
Returns
this element

◆ SetRotationAngle() [2/2]

virtual iText.Layout.Style iText.Layout.Style.SetRotationAngle ( float  radAngle )
inlinevirtual

Sets the rotation radAngle.

Parameters
radAngle the new rotation radAngle, as a float
Returns
this element

◆ SetSpacingRatio()

virtual iText.Layout.Style iText.Layout.Style.SetSpacingRatio ( float  ratio )
inlinevirtual

Sets a ratio which determines in which proportion will word spacing and character spacing be applied when horizontal alignment is justified.

Parameters
ratio the ratio coefficient. It must be between 0 and 1, inclusive. It means that ratio part of the free space will be compensated by word spacing, and 1-ratio part of the free space will be compensated by character spacing. If ratio is 1, additional character spacing will not be applied. If ratio is 0, additional word spacing will not be applied.
Returns
this element

◆ SetVerticalAlignment()

virtual iText.Layout.Style iText.Layout.Style.SetVerticalAlignment ( VerticalAlignment verticalAlignment )
inlinevirtual

Sets the vertical alignment of the element.

Parameters
verticalAlignment the vertical alignment setting
Returns
this element

◆ SetWidth() [1/2]

virtual iText.Layout.Style iText.Layout.Style.SetWidth ( float  width )
inlinevirtual

Sets the width property of the element, measured in points.

Parameters
width a value measured in points.
Returns
this Element.

◆ SetWidth() [2/2]

virtual iText.Layout.Style iText.Layout.Style.SetWidth ( UnitValue  width )
inlinevirtual

Sets the width property of the element with a iText.Layout.Properties.UnitValue.

Parameters
width a iText.Layout.Properties.UnitValue object
Returns
this Element.