T
- this type
public abstract class ElementPropertyContainerIPropertyContainer> extends Object implements IPropertyContainer
layout object
implementations.
Modifier and Type | Field and Description |
---|---|
protected Map<Integer,Object> |
properties |
Constructor and Description |
---|
ElementPropertyContainer() |
Modifier and Type | Method and Description |
---|---|
void |
deleteOwnProperty(int property)
Deletes the own property of this entity.
|
|
getDefaultProperty(int property)
Gets the default property from this entity.
|
|
getOwnProperty(int property)
Gets own property from this entity.
|
|
getProperty(int property)
Gets the property from this entity.
|
ISplitCharacters |
getSplitCharacters()
Gets a rule for splitting strings when they don't fit into one line.
|
Color |
getStrokeColor()
Gets the stroke color for the current element.
|
Float |
getStrokeWidth()
Gets the stroke width for the current element.
|
Integer |
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.
|
boolean |
hasOwnProperty(int property)
Checks if this entity has the specified property, i.e.
|
boolean |
hasProperty(int property)
Checks if this entity has the specified property.
|
T |
setBackgroundColor(Color backgroundColor)
Specifies a background color for the Element.
|
T |
setBackgroundColor(Color backgroundColor, float opacity)
Specifies a background color for the Element.
|
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.
|
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.
|
T |
setBackgroundImage(BackgroundImage image)
Specifies a background image for the Element.
|
T |
setBackgroundImage(List<BackgroundImage> imagesList)
Specifies a list of background images for the Element.
|
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.
|
T |
setBold()
Switch on the simulation of bold style for a font.
|
T |
setBorder(Border border)
Sets a border for all four edges of this Element with customizable color, width, pattern type.
|
T |
setBorderBottom(Border border)
Sets a border for the bottom limit of this Element with customizable color, width, pattern type.
|
T |
setBorderBottomLeftRadius(BorderRadius borderRadius)
Sets a border radius for the bottom left corner of this Element.
|
T |
setBorderBottomRightRadius(BorderRadius borderRadius)
Sets a border radius for the bottom right corner of this Element.
|
T |
setBorderLeft(Border border)
Sets a border for the left limit of this Element with customizable color, width, pattern type.
|
T |
setBorderRadius(BorderRadius borderRadius)
Sets a border radius for all four edges of this Element.
|
T |
setBorderRight(Border border)
Sets a border for the right limit of this Element with customizable color, width, pattern type.
|
T |
setBorderTop(Border border)
Sets a border for the upper limit of this Element with customizable color, width, pattern type.
|
T |
setBorderTopLeftRadius(BorderRadius borderRadius)
Sets a border radius for the top left corner of this Element.
|
T |
setBorderTopRightRadius(BorderRadius borderRadius)
Sets a border radius for the top right corner of this Element.
|
T |
setCharacterSpacing(float charSpacing)
Defines a custom spacing distance between all characters of a textual element.
|
T |
setDestination(String destination)
Sets a destination name that will be created when this element is drawn to content.
|
T |
setFixedPosition(float left, float bottom, float width)
Sets values for a absolute repositioning of the Element.
|
T |
setFixedPosition(float left, float bottom, UnitValue width)
Sets values for a absolute repositioning of the Element.
|
T |
setFixedPosition(int pageNumber, float left, float bottom, float width)
Sets values for a absolute repositioning of the Element.
|
T |
setFixedPosition(int pageNumber, float left, float bottom, UnitValue width)
Sets values for a absolute repositioning of the Element.
|
T |
setFont(PdfFont font)
Sets the font of this Element.
|
T |
setFont(String font)
Deprecated.
This method will be removed in 7.2. Use
setFontFamily(String...) instead.
|
T |
setFontColor(Color fontColor)
Sets the font color of this Element.
|
T |
setFontColor(Color fontColor, float opacity)
Sets the font color of this Element and the opacity of the text.
|
T |
setFontFamily(List<String> fontFamilyNames)
Sets the preferable font families for this Element.
|
T |
setFontFamily(String... fontFamilyNames)
Sets the preferable font families for this Element.
|
T |
setFontKerning(FontKerning fontKerning)
Enable or disable kerning.
|
T |
setFontScript(Character.UnicodeScript script)
Sets the writing system for this text element.
|
T |
setFontSize(float fontSize)
Sets the font size of this Element, measured in points.
|
T |
setHorizontalAlignment(HorizontalAlignment horizontalAlignment)
Sets the horizontal alignment of this Element.
|
T |
setHyphenation(HyphenationConfig hyphenationConfig)
Sets a custom hyphenation configuration which will hyphenate words automatically accordingly to the language and country.
|
T |
setItalic()
Switch on the simulation of italic style for a font.
|
T |
setLineThrough()
Sets default line-through attributes for text.
|
T |
setOpacity(Float opacity)
Sets an opacity of the given element.
|
void |
setProperty(int property, Object value)
Sets a property for this entity.
|
T |
setRelativePosition(float left, float top, float right, float bottom)
Sets values for a relative repositioning of the Element.
|
T |
setSplitCharacters(ISplitCharacters splitCharacters)
Sets a rule for splitting strings when they don't fit into one line.
|
T |
setStrokeColor(Color strokeColor)
Sets the stroke color for the current element.
|
T |
setStrokeWidth(float strokeWidth)
Sets the stroke width for the current element.
|
T |
setTextAlignment(TextAlignment alignment)
Sets the text alignment of this Element.
|
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.
|
T |
setUnderline()
Sets default underline attributes for text.
|
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.
|
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.
|
T |
setUnderline(float thickness, float yPosition)
Sets an horizontal line that can be an underline or a strikethrough.
|
T |
setWordSpacing(float wordSpacing)
Defines a custom spacing distance between words of a textual element.
|
public void setProperty(int property, Object value)
IPropertyContainer
setProperty
in interface IPropertyContainer
property
- the property to be set
value
- the value of the property
public boolean hasProperty(int property)
IPropertyContainer
IPropertyContainer.hasOwnProperty(int)
, this method can check parent's properties, styles, etc, depending on the origin of the instance
hasProperty
in interface IPropertyContainer
property
- the property to be checked
true
if this instance has given property, false
otherwise
public boolean hasOwnProperty(int property)
IPropertyContainer
hasOwnProperty
in interface IPropertyContainer
property
- the property to be checked
true
if this instance has given own property, false
otherwise
public void deleteOwnProperty(int property)
IPropertyContainer
deleteOwnProperty
in interface IPropertyContainer
property
- the property to be deleted
publicT1 getProperty(int property)
IPropertyContainer
IPropertyContainer.getOwnProperty(int)
, this method can check parent's properties, styles, etc, depending on the origin of the instance
getProperty
in interface IPropertyContainer
T1
- the return type associated with the property
property
- the property to be retrieved
null
will be returned if the property value was not found
publicT1 getOwnProperty(int property)
IPropertyContainer
null
will be returned.
getOwnProperty
in interface IPropertyContainer
T1
- the return type associated with the property
property
- the property to be retrieved
null
will be returned if the property value was not found
publicT1 getDefaultProperty(int property)
IPropertyContainer
getDefaultProperty
in interface IPropertyContainer
T1
- the return type associated with the property
property
- the property to be retrieved
null
will be returned
public T setRelativePosition(float left, float top, float right, float bottom)
Property.POSITION
is changed to relative
. The default implementation in AbstractRenderer
treats left
and top
as the most important values. Only if left == 0
will right
be used for the calculation; ditto for top vs. bottom.
left
- movement to the left
top
- movement upwards on the page
right
- movement to the right
bottom
- movement downwards on the page
LayoutPosition.RELATIVE
public T setFixedPosition(float left, float bottom, float width)
Property.POSITION
is changed to fixed
.
left
- horizontal position of the bottom-left corner on the page
bottom
- vertical position of the bottom-left corner on the page
width
- a floating point value measured in points.
public T setFixedPosition(float left, float bottom, UnitValue width)
Property.POSITION
is changed to fixed
.
left
- horizontal position of the bottom-left corner on the page
bottom
- vertical position of the bottom-left corner on the page
width
- a UnitValue
public T setFixedPosition(int pageNumber, float left, float bottom, float width)
Property.POSITION
is changed to fixed
.
pageNumber
- the page where the element must be positioned
left
- horizontal position of the bottom-left corner on the page
bottom
- vertical position of the bottom-left corner on the page
width
- a floating point value measured in points.
public T setFixedPosition(int pageNumber, float left, float bottom, UnitValue width)
Property.POSITION
is changed to fixed
.
pageNumber
- the page where the element must be positioned
left
- horizontal position of the bottom-left corner on the page
bottom
- vertical position of the bottom-left corner on the page
width
- a floating point value measured in points.
public T setHorizontalAlignment(HorizontalAlignment horizontalAlignment)
horizontalAlignment
- an enum value of type HorizontalAlignment
public T setFont(PdfFont font)
This property overrides the value set by setFontFamily(java.lang.String...)
. Font is set either via exact PdfFont
instance or via font-family name that should correspond to the font in FontProvider
, but not both.
font
- a font
public T setFontFamily(String... fontFamilyNames)
FontProvider
shall be set as well. See RootElement.setFontProvider(FontProvider)
This property overrides the value set by setFont(PdfFont)
. Font is set either via exact PdfFont
instance or via font-family name that should correspond to the font in FontProvider
, but not both.
All String
that are passed as argument are directly handled as a collection of font family names, without any pre-processing. Every font family name is treated as a preferable font-family to be used inside the element. The fontFamilyNames
argument is interpreted as as an ordered list, where every next font-family should be used if font for the previous one was not found or doesn't contain required glyphs.
fontFamilyNames
- defines an ordered list of preferable font families for this Element.
StandardFontFamilies
public T setFontFamily(List<String> fontFamilyNames)
FontProvider
shall be set as well. See RootElement.setFontProvider(FontProvider)
This property overrides the value set by setFont(PdfFont)
. Font is set either via exact PdfFont
instance or via font-family name that should correspond to the font in FontProvider
, but not both.
All String
that are passed as argument are directly handled as a collection of font family names, without any pre-processing. Every font family name is treated as a preferable font-family to be used inside the element. The fontFamilyNames
argument is interpreted as as an ordered list, where every next font-family should be used if font for the previous one was not found or doesn't contain required glyphs.
fontFamilyNames
- defines an ordered list of preferable font families for this Element.
StandardFontFamilies
@Deprecated public T setFont(String font)
setFontFamily(String...)
instead.
FontProvider
shall be set as well. See RootElement.setFontProvider(FontProvider)
font
- a font name to fetch from FontProvider
StandardFontFamilies
public T setFontColor(Color fontColor)
fontColor
- a Color
for the text in this Element.
public T setFontColor(Color fontColor, float opacity)
fontColor
- a Color
for the text in this Element.
opacity
- an opacity for the text in this Element; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent.
public T setFontSize(float fontSize)
fontSize
- a floating point value
public T setTextAlignment(TextAlignment alignment)
alignment
- an enum value of type TextAlignment
public T setCharacterSpacing(float charSpacing)
charSpacing
- a floating point value
public T setWordSpacing(float wordSpacing)
wordSpacing
- a floating point value
public T setFontKerning(FontKerning fontKerning)
fontKerning
- an enum value as a boolean wrapper specifying whether or not to apply kerning
public T setBackgroundColor(Color backgroundColor)
backgroundColor
- the background color
public T setBackgroundColor(Color backgroundColor, float opacity)
backgroundColor
- the background color
opacity
- the background color opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent.
public T setBackgroundColor(Color backgroundColor, float extraLeft, float extraTop, float extraRight, float extraBottom)
backgroundColor
- the background color
extraLeft
- extra coloring to the left side
extraTop
- extra coloring at the top
extraRight
- extra coloring to the right side
extraBottom
- extra coloring at the bottom
public T setBackgroundColor(Color backgroundColor, float opacity, float extraLeft, float extraTop, float extraRight, float extraBottom)
backgroundColor
- the background color
opacity
- the background color opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
extraLeft
- extra coloring to the left side
extraTop
- extra coloring at the top
extraRight
- extra coloring to the right side
extraBottom
- extra coloring at the bottom
public T setBackgroundImage(BackgroundImage image)
image
- BackgroundImage
public T setBackgroundImage(List<BackgroundImage> imagesList)
imagesList
- List of BackgroundImage
public T setBorder(Border border)
border
- a customized Border
public T setBorderTop(Border border)
border
- a customized Border
public T setBorderRight(Border border)
border
- a customized Border
public T setBorderBottom(Border border)
border
- a customized Border
public T setBorderLeft(Border border)
border
- a customized Border
public T setBorderRadius(BorderRadius borderRadius)
borderRadius
- a customized BorderRadius
public T setBorderBottomLeftRadius(BorderRadius borderRadius)
borderRadius
- a customized BorderRadius
public T setBorderBottomRightRadius(BorderRadius borderRadius)
borderRadius
- a customized BorderRadius
public T setBorderTopLeftRadius(BorderRadius borderRadius)
borderRadius
- a customized BorderRadius
public T setBorderTopRightRadius(BorderRadius borderRadius)
borderRadius
- a customized BorderRadius
public T setSplitCharacters(ISplitCharacters splitCharacters)
DefaultSplitCharacters
splitCharacters
- an implementation of ISplitCharacters
public ISplitCharacters getSplitCharacters()
ISplitCharacters
public Integer getTextRenderingMode()
PdfCanvasConstants.TextRenderingMode
public T setTextRenderingMode(int textRenderingMode)
textRenderingMode
- an int
value
PdfCanvasConstants.TextRenderingMode
public Color getStrokeColor()
public T setStrokeColor(Color strokeColor)
strokeColor
- a new stroke color
public Float getStrokeWidth()
public T setStrokeWidth(float strokeWidth)
strokeWidth
- a new stroke width
public T setBold()
public T setItalic()
public T setLineThrough()
setUnderline(Color, float, float, float, float, int)
for more fine tuning.
public T setUnderline()
public T setUnderline(float thickness, float yPosition)
thickness
- the absolute thickness of the line
yPosition
- the absolute y position relative to the baseline
public T setUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)
The thickness of the line will be thickness + thicknessMul * fontSize
. The position of the line will be baseLine + yPosition + yPositionMul * fontSize
.
color
- the color of the line or null
to follow the text color
thickness
- the absolute thickness of the line
thicknessMul
- the thickness multiplication factor with the font size
yPosition
- the absolute y position relative to the baseline
yPositionMul
- the position multiplication factor with the font size
lineCapStyle
- the end line cap style. Allowed values are enumerated in PdfCanvasConstants.LineCapStyle
public T setUnderline(Color color, float opacity, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)
The thickness of the line will be thickness + thicknessMul * fontSize
. The position of the line will be baseLine + yPosition + yPositionMul * fontSize
.
color
- the color of the line or null
to follow the text color
opacity
- the opacity of the line; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
thickness
- the absolute thickness of the line
thicknessMul
- the thickness multiplication factor with the font size
yPosition
- the absolute y position relative to the baseline
yPositionMul
- the position multiplication factor with the font size
lineCapStyle
- the end line cap style. Allowed values are enumerated in PdfCanvasConstants.LineCapStyle
public T setBaseDirection(BaseDirection baseDirection)
baseDirection
- base direction
public T setHyphenation(HyphenationConfig hyphenationConfig)
hyphenationConfig
- The hyphenation configuration
public T setFontScript(Character.UnicodeScript script)
script
- a new script type
public T setDestination(String destination)
destination
- the destination name to be created
public T setOpacity(Float opacity)
opacity
- a float between 0 and 1, where 1 stands for fully opaque element and 0 - for fully transparent
Copyright © 1998–2023 iText Group NV. All rights reserved.