iText 8.0.4 API
iText.Layout.Element.AbstractElement< T > Class Template Referenceabstract

Defines the most common properties that most IElement implementations share. More...

Inheritance diagram for iText.Layout.Element.AbstractElement< T >:
iText.Layout.ElementPropertyContainer< T > iText.Layout.Element.IAbstractElement iText.Commons.Actions.Sequence.AbstractIdentifiableElement iText.Layout.IPropertyContainer iText.Layout.Element.IElement iText.Layout.IPropertyContainer iText.Forms.Form.Element.FormField< T > iText.Layout.Element.BlockElement< T >

Public Member Functions

virtual IRenderer  GetRenderer ()
  Gets a renderer for this element. More...
 
virtual void  SetNextRenderer (IRenderer renderer)
  Overrides the iText.Layout.Renderer.IRenderer instance which will be returned by the next call to the GetRenderer(). More...
 
virtual IRenderer  CreateRendererSubTree ()
  Creates a renderer subtree with root in the current element. More...
 
override bool  HasProperty (int property)
  Checks if this entity has the specified property. More...
 
override T1  GetProperty< T1 > (int property)
  Gets the property from this entity. More...
 
virtual T  AddStyle (Style style)
  Add a new style to this element. More...
 
virtual IList< IElement GetChildren ()
  Gets the child elements of this elements More...
 
virtual bool  IsEmpty ()
  Returns true if this list contains no elements. More...
 
virtual T  SetAction (PdfAction action)
  Sets an action on this Element. More...
 
virtual T  SetPageNumber (int pageNumber)
  Explicitly sets the page number this element should be put on. More...
 
- Public Member Functions inherited from iText.Layout.ElementPropertyContainer< T >
virtual void  SetProperty (int property, Object value)
  Sets a property for this entity. 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  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  SetBold ()
  Switch on the simulation of bold style for a font. More...
 
virtual T  SetItalic ()
  Switch on the simulation of 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...
 

Detailed Description

Defines the most common properties that most IElement implementations share.

Template Parameters
T the type of the implementation
Type Constraints
T  : IElement  

Member Function Documentation

◆ AddStyle()

virtual T iText.Layout.Element.AbstractElement< T >.AddStyle ( Style  style )
inlinevirtual

Add a new style to this element.

Add a new style to this element. A style can be used as an effective way to define multiple equal properties to several elements, however its properties have lower priority than properties, directly set on iText.Layout.ElementPropertyContainer Note that if several Style objects are added, iText checks them one by one in the order in which they were added and returns the property's value from the last Style object, which contains this property. So, if there are two Style objects added: the first has set width of 100 points and the second of 200 points, iText will get 200 points as width value.

Parameters
style the style to be added
Returns
this element

◆ CreateRendererSubTree()

virtual IRenderer iText.Layout.Element.AbstractElement< T >.CreateRendererSubTree ( )
inlinevirtual

Creates a renderer subtree with root in the current element.

Creates a renderer subtree with root in the current element. Compared to GetRenderer() , the renderer returned by this method should contain all the child renderers for children of the current element.

Returns
a renderer subtree for this element

Implements iText.Layout.Element.IElement.

◆ GetChildren()

virtual IList<IElement> iText.Layout.Element.AbstractElement< T >.GetChildren ( )
inlinevirtual

Gets the child elements of this elements

Returns
a list of children

Implements iText.Layout.Element.IAbstractElement.

◆ GetProperty< T1 >()

override T1 iText.Layout.Element.AbstractElement< T >.GetProperty< T1 > ( int  property )
inlinevirtual

Gets the property from this entity.

Gets the property from this entity. Compared to GetOwnProperty(int) , this method can check parent's properties, styles, etc, depending on the origin of the instance

Template Parameters
T1 the return type associated with the property
Parameters
property the property to be retrieved
Returns
the value of the given property. null will be returned if the property value was not found

Reimplemented from iText.Layout.ElementPropertyContainer< T >.

◆ GetRenderer()

virtual IRenderer iText.Layout.Element.AbstractElement< T >.GetRenderer ( )
inlinevirtual

Gets a renderer for this element.

Gets a renderer for this element. Note that this method can be called more than once. By default each element should define its own renderer, but the renderer can be overridden by SetNextRenderer(iText.Layout.Renderer.IRenderer) method call.

Returns
a renderer for this element

Implements iText.Layout.Element.IElement.

◆ HasProperty()

override bool iText.Layout.Element.AbstractElement< T >.HasProperty ( int  property )
inlinevirtual

Checks if this entity has the specified property.

Checks if this entity has the specified property. Compared to HasOwnProperty(int) , this method can check parent's properties, styles, etc, depending on the origin of the instance

Parameters
property the property to be checked
Returns

true if this instance has given property, false otherwise

Reimplemented from iText.Layout.ElementPropertyContainer< T >.

◆ IsEmpty()

virtual bool iText.Layout.Element.AbstractElement< T >.IsEmpty ( )
inlinevirtual

Returns true if this list contains no elements.

Returns
true if this list contains no elements

◆ SetAction()

virtual T iText.Layout.Element.AbstractElement< T >.SetAction ( PdfAction  action )
inlinevirtual

Sets an action on this Element.

Sets an action on this Element. An action is a general PDF concept that signifies anything that makes the document interactive, e.g. a hyperlink or a button.

Parameters
action the iText.Kernel.Pdf.Action.PdfAction that should be performed
Returns
this Element

◆ SetNextRenderer()

virtual void iText.Layout.Element.AbstractElement< T >.SetNextRenderer ( IRenderer  renderer )
inlinevirtual

Overrides the iText.Layout.Renderer.IRenderer instance which will be returned by the next call to the GetRenderer().

Parameters
renderer the renderer instance

Implements iText.Layout.Element.IElement.

◆ SetPageNumber()

virtual T iText.Layout.Element.AbstractElement< T >.SetPageNumber ( int  pageNumber )
inlinevirtual

Explicitly sets the page number this element should be put on.

Explicitly sets the page number this element should be put on. The location on the page will be the same as if it were added at the end of the document, but it will be located on the specified page.

This method should be used very carefully in client code.

Parameters
pageNumber the page number of the page this element should be placed on
Returns
this Element