Class ElementPropertyContainer<T>
A generic abstract element that fits in a PDF layout object hierarchy.
public abstract class ElementPropertyContainer<T> : AbstractIdentifiableElement, IPropertyContainer where T : IPropertyContainer
Type Parameters
T
this type
- Inheritance
-
ElementPropertyContainer<T>
- Implements
- Derived
Remarks
A generic abstract element that fits in a PDF layout object hierarchy. A superclass of all layout object implementations.
Constructors
ElementPropertyContainer()
protected ElementPropertyContainer()
Fields
properties
protected IDictionary<int, object> properties
Field Value
Methods
DeleteOwnProperty(int)
public virtual void DeleteOwnProperty(int property)
Parameters
property
int
GetDefaultProperty<T1>(int)
public virtual T1 GetDefaultProperty<T1>(int property)
Parameters
property
int
Returns
- T1
Type Parameters
T1
GetOwnProperty<T1>(int)
public virtual T1 GetOwnProperty<T1>(int property)
Parameters
property
int
Returns
- T1
Type Parameters
T1
GetProperty<T1>(int)
public virtual T1 GetProperty<T1>(int property)
Parameters
property
int
Returns
- T1
Type Parameters
T1
GetSplitCharacters()
Gets a rule for splitting strings when they don't fit into one line.
public virtual ISplitCharacters GetSplitCharacters()
Returns
- ISplitCharacters
the current string splitting rule, an implementation of ISplitCharacters
GetStrokeColor()
Gets the stroke color for the current element.
public virtual Color GetStrokeColor()
Returns
- Color
the current stroke color
Remarks
Gets the stroke color for the current element. The stroke color is the color of the outlines or edges of a shape.
GetStrokeWidth()
Gets the stroke width for the current element.
public virtual float? GetStrokeWidth()
Returns
- float?
the current stroke width
Remarks
Gets the stroke width for the current element. The stroke width is the width of the outlines or edges of a shape.
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.
public virtual int? GetTextRenderingMode()
Returns
- int?
the current text rendering mode
- See Also
HasOwnProperty(int)
public virtual bool HasOwnProperty(int property)
Parameters
property
int
Returns
HasProperty(int)
public virtual bool HasProperty(int property)
Parameters
property
int
Returns
SetBackgroundColor(Color)
Specifies a background color for the Element.
public virtual T SetBackgroundColor(Color backgroundColor)
Parameters
backgroundColor
Colorthe background color
Returns
- T
this Element.
SetBackgroundColor(Color, float)
Specifies a background color for the Element.
public virtual T SetBackgroundColor(Color backgroundColor, float opacity)
Parameters
backgroundColor
Colorthe background color
opacity
floatthe background color opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent.
Returns
- T
this Element.
SetBackgroundColor(Color, float, float, float, float)
Specifies a background color for the Element, and extra space that must be counted as part of the background and therefore colored.
public virtual T SetBackgroundColor(Color backgroundColor, float extraLeft, float extraTop, float extraRight, float extraBottom)
Parameters
backgroundColor
Colorthe background color
extraLeft
floatextra coloring to the left side
extraTop
floatextra coloring at the top
extraRight
floatextra coloring to the right side
extraBottom
floatextra coloring at the bottom
Returns
- T
this Element.
SetBackgroundColor(Color, float, float, float, float, float)
Specifies a background color for the Element, and extra space that must be counted as part of the background and therefore colored.
public virtual T SetBackgroundColor(Color backgroundColor, float opacity, float extraLeft, float extraTop, float extraRight, float extraBottom)
Parameters
backgroundColor
Colorthe background color
opacity
floatthe background color opacity; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
extraLeft
floatextra coloring to the left side
extraTop
floatextra coloring at the top
extraRight
floatextra coloring to the right side
extraBottom
floatextra coloring at the bottom
Returns
- T
this Element.
SetBackgroundImage(IList<BackgroundImage>)
Specifies a list of background images for the Element.
public virtual T SetBackgroundImage(IList<BackgroundImage> imagesList)
Parameters
imagesList
IList<BackgroundImage>List of BackgroundImage
Returns
- T
this Element.
SetBackgroundImage(BackgroundImage)
Specifies a background image for the Element.
public virtual T SetBackgroundImage(BackgroundImage image)
Parameters
Returns
- T
this Element.
SetBaseDirection(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.
public virtual T SetBaseDirection(BaseDirection? baseDirection)
Parameters
baseDirection
BaseDirection?base direction
Returns
- T
this element
SetBold()
Switch on the simulation of bold style for a font.
public virtual T SetBold()
Returns
- T
this element
Remarks
Switch on the simulation of bold style for a font. Be aware that using correct bold font is highly preferred over this option.
SetBorder(Border)
Sets a border for all four edges of this Element with customizable color, width, pattern type.
public virtual T SetBorder(Border border)
Parameters
Returns
- T
this Element.
SetBorderBottom(Border)
Sets a border for the bottom limit of this Element with customizable color, width, pattern type.
public virtual T SetBorderBottom(Border border)
Parameters
Returns
- T
this Element.
SetBorderBottomLeftRadius(BorderRadius)
Sets a border radius for the bottom left corner of this Element.
public virtual T SetBorderBottomLeftRadius(BorderRadius borderRadius)
Parameters
borderRadius
BorderRadiusa customized BorderRadius
Returns
- T
this Element.
SetBorderBottomRightRadius(BorderRadius)
Sets a border radius for the bottom right corner of this Element.
public virtual T SetBorderBottomRightRadius(BorderRadius borderRadius)
Parameters
borderRadius
BorderRadiusa customized BorderRadius
Returns
- T
this Element.
SetBorderLeft(Border)
Sets a border for the left limit of this Element with customizable color, width, pattern type.
public virtual T SetBorderLeft(Border border)
Parameters
Returns
- T
this Element.
SetBorderRadius(BorderRadius)
Sets a border radius for all four edges of this Element.
public virtual T SetBorderRadius(BorderRadius borderRadius)
Parameters
borderRadius
BorderRadiusa customized BorderRadius
Returns
- T
this Element.
SetBorderRight(Border)
Sets a border for the right limit of this Element with customizable color, width, pattern type.
public virtual T SetBorderRight(Border border)
Parameters
Returns
- T
this Element.
SetBorderTop(Border)
Sets a border for the upper limit of this Element with customizable color, width, pattern type.
public virtual T SetBorderTop(Border border)
Parameters
Returns
- T
this Element.
SetBorderTopLeftRadius(BorderRadius)
Sets a border radius for the top left corner of this Element.
public virtual T SetBorderTopLeftRadius(BorderRadius borderRadius)
Parameters
borderRadius
BorderRadiusa customized BorderRadius
Returns
- T
this Element.
SetBorderTopRightRadius(BorderRadius)
Sets a border radius for the top right corner of this Element.
public virtual T SetBorderTopRightRadius(BorderRadius borderRadius)
Parameters
borderRadius
BorderRadiusa customized BorderRadius
Returns
- T
this Element.
SetCharacterSpacing(float)
Defines a custom spacing distance between all characters of a textual element.
public virtual T SetCharacterSpacing(float charSpacing)
Parameters
charSpacing
floata floating point value
Returns
- T
this Element.
Remarks
Defines a custom spacing distance between all characters of a textual element. The character-spacing parameter is added to the glyph's horizontal or vertical displacement (depending on the writing mode).
SetDestination(string)
Sets a destination name that will be created when this element is drawn to content.
public virtual T SetDestination(string destination)
Parameters
destination
stringthe destination name to be created
Returns
- T
this Element.
SetFixedPosition(int, float, float, float)
Sets values for a absolute repositioning of the Element.
public virtual T SetFixedPosition(int pageNumber, float left, float bottom, float width)
Parameters
pageNumber
intthe page where the element must be positioned
left
floathorizontal position of the bottom-left corner on the page
bottom
floatvertical position of the bottom-left corner on the page
width
floata floating point value measured in points.
Returns
- T
this Element.
Remarks
Sets values for a absolute repositioning of the Element. The coordinates specified correspond to the bottom-left corner of the element and it grows upwards. Also has as a side effect that the Element's POSITION is changed to fixed.
SetFixedPosition(int, float, float, UnitValue)
Sets values for a absolute repositioning of the Element.
public virtual T SetFixedPosition(int pageNumber, float left, float bottom, UnitValue width)
Parameters
pageNumber
intthe page where the element must be positioned
left
floathorizontal position of the bottom-left corner on the page
bottom
floatvertical position of the bottom-left corner on the page
width
UnitValuea floating point value measured in points.
Returns
- T
this Element.
Remarks
Sets values for a absolute repositioning of the Element. The coordinates specified correspond to the bottom-left corner of the element and it grows upwards. Also has as a side effect that the Element's POSITION is changed to fixed.
SetFixedPosition(float, float, float)
Sets values for a absolute repositioning of the Element.
public virtual T SetFixedPosition(float left, float bottom, float width)
Parameters
left
floathorizontal position of the bottom-left corner on the page
bottom
floatvertical position of the bottom-left corner on the page
width
floata floating point value measured in points.
Returns
- T
this Element.
Remarks
Sets values for a absolute repositioning of the Element. The coordinates specified correspond to the bottom-left corner of the element and it grows upwards. Also has as a side effect that the Element's POSITION is changed to fixed.
SetFixedPosition(float, float, UnitValue)
Sets values for an absolute repositioning of the Element.
public virtual T SetFixedPosition(float left, float bottom, UnitValue width)
Parameters
left
floathorizontal position of the bottom-left corner on the page
bottom
floatvertical position of the bottom-left corner on the page
width
UnitValue
Returns
- T
this Element.
Remarks
Sets values for an absolute repositioning of the Element. The coordinates specified correspond to the bottom-left corner of the element, and it grows upwards. Also has as a side effect that the Element's POSITION is changed to fixed.
SetFont(PdfFont)
Sets the font of this Element.
public virtual T SetFont(PdfFont font)
Parameters
Returns
- T
this Element.
Remarks
Sets the font of this Element.
This property overrides the value set by SetFontFamily(params 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.SetFontColor(Color)
Sets the font color of this Element.
public virtual T SetFontColor(Color fontColor)
Parameters
Returns
- T
this Element.
SetFontColor(Color, float)
Sets the font color of this Element and the opacity of the text.
public virtual T SetFontColor(Color fontColor, float opacity)
Parameters
fontColor
Colora Color for the text in this Element.
opacity
floatan 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.
Returns
- T
this Element.
SetFontColor(TransparentColor)
public virtual T SetFontColor(TransparentColor transparentColor)
Parameters
transparentColor
TransparentColor
Returns
- T
SetFontFamily(IList<string>)
Sets the preferable font families for this Element.
public virtual T SetFontFamily(IList<string> fontFamilyNames)
Parameters
Returns
- T
this Element.
Remarks
Sets the preferable font families for this Element. Note that FontProvider shall be set as well. See 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. ThefontFamilyNames
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.
- See Also
SetFontFamily(params string[])
Sets the preferable font families for this Element.
public virtual T SetFontFamily(params string[] fontFamilyNames)
Parameters
fontFamilyNames
string[]defines an ordered list of preferable font families for this Element.
Returns
- T
this Element.
Remarks
Sets the preferable font families for this Element. Note that FontProvider shall be set as well. See 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. ThefontFamilyNames
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.
- See Also
SetFontKerning(FontKerning)
Enable or disable kerning.
public virtual T SetFontKerning(FontKerning fontKerning)
Parameters
fontKerning
FontKerningan enum value as a boolean wrapper specifying whether or not to apply kerning
Returns
- T
this Element.
Remarks
Enable or disable kerning. Some fonts may specify kern pairs, i.e. pair of glyphs, between which the amount of horizontal space is adjusted. This adjustment is typically negative, e.g. in "AV" pair the glyphs will typically be moved closer to each other.
SetFontScript(UnicodeScript?)
Sets the writing system for this text element.
public virtual T SetFontScript(UnicodeScript? script)
Parameters
script
UnicodeScript?a new script type
Returns
- T
this Element.
SetFontSize(float)
Sets the font size of this Element, measured in points.
public virtual T SetFontSize(float fontSize)
Parameters
fontSize
floata floating point value
Returns
- T
this Element.
SetHorizontalAlignment(HorizontalAlignment?)
Sets the horizontal alignment of this Element.
public virtual T SetHorizontalAlignment(HorizontalAlignment? horizontalAlignment)
Parameters
horizontalAlignment
HorizontalAlignment?an enum value of type
Returns
- T
this Element.
SetHyphenation(HyphenationConfig)
Sets a custom hyphenation configuration which will hyphenate words automatically accordingly to the language and country.
public virtual T SetHyphenation(HyphenationConfig hyphenationConfig)
Parameters
hyphenationConfig
HyphenationConfigThe hyphenation configuration
Returns
- T
this element
SetItalic()
Switch on the simulation of italic style for a font.
public virtual T SetItalic()
Returns
- T
this element
Remarks
Switch on the simulation of italic style for a font. Be aware that using correct italic (oblique) font is highly preferred over this option.
SetLineThrough()
Sets default line-through attributes for text.
public virtual T SetLineThrough()
Returns
- T
this element
Remarks
Sets default line-through attributes for text. See SetUnderline(Color, float, float, float, float, int) for more fine tuning.
SetOpacity(float?)
Sets an opacity of the given element.
public virtual T SetOpacity(float? opacity)
Parameters
opacity
float?a float between 0 and 1, where 1 stands for fully opaque element and 0 - for fully transparent
Returns
- T
this Element.
Remarks
Sets an opacity of the given element. It will affect element content, borders and background. Note, that it will also affect all element children, as they are the content of the given element.
SetProperty(int, object)
public virtual void SetProperty(int property, object value)
Parameters
SetRelativePosition(float, float, float, float)
Sets values for a relative repositioning of the Element.
public virtual T SetRelativePosition(float left, float top, float right, float bottom)
Parameters
left
floatmovement to the left
top
floatmovement upwards on the page
right
floatmovement to the right
bottom
floatmovement downwards on the page
Returns
- T
this Element.
Remarks
Sets values for a relative repositioning of the Element. Also has as a
side effect that the Element's
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.
- See Also
SetSplitCharacters(ISplitCharacters)
Sets a rule for splitting strings when they don't fit into one line.
public virtual T SetSplitCharacters(ISplitCharacters splitCharacters)
Parameters
splitCharacters
ISplitCharactersan implementation of ISplitCharacters
Returns
- T
this Element.
Remarks
Sets a rule for splitting strings when they don't fit into one line. The default implementation is DefaultSplitCharacters
SetStrokeColor(Color)
Sets the stroke color for the current element.
public virtual T SetStrokeColor(Color strokeColor)
Parameters
strokeColor
Colora new stroke color
Returns
- T
this Element.
Remarks
Sets the stroke color for the current element. The stroke color is the color of the outlines or edges of a shape.
SetStrokeWidth(float)
Sets the stroke width for the current element.
public virtual T SetStrokeWidth(float strokeWidth)
Parameters
strokeWidth
floata new stroke width
Returns
- T
this Element.
Remarks
Sets the stroke width for the current element. The stroke width is the width of the outlines or edges of a shape.
SetTextAlignment(TextAlignment?)
Sets the text alignment of this Element.
public virtual T SetTextAlignment(TextAlignment? alignment)
Parameters
alignment
TextAlignment?an enum value of type
Returns
- T
this Element.
SetTextRenderingMode(int)
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.
public virtual T SetTextRenderingMode(int textRenderingMode)
Parameters
textRenderingMode
intan
int
value
Returns
- T
this Element.
- See Also
SetUnderline()
Sets default underline attributes for text.
public virtual T SetUnderline()
Returns
- T
this element
Remarks
Sets default underline attributes for text. See other overloads for more fine tuning.
SetUnderline(float, float)
Sets an horizontal line that can be an underline or a strikethrough.
public virtual T SetUnderline(float thickness, float yPosition)
Parameters
thickness
floatthe absolute thickness of the line
yPosition
floatthe absolute y position relative to the baseline
Returns
- T
this element
Remarks
Sets an horizontal line that can be an underline or a strikethrough. Actually, the line can be anywhere vertically and has always the text width. Multiple call to this method will produce multiple lines.
SetUnderline(Color, float, float, float, float, int)
Sets an horizontal line that can be an underline or a strikethrough.
public virtual T SetUnderline(Color color, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)
Parameters
color
Colorthe color of the line or
null
to follow the text colorthickness
floatthe absolute thickness of the line
thicknessMul
floatthe thickness multiplication factor with the font size
yPosition
floatthe absolute y position relative to the baseline
yPositionMul
floatthe position multiplication factor with the font size
lineCapStyle
intthe end line cap style. Allowed values are enumerated in PdfCanvasConstants.LineCapStyle
Returns
- T
this element
Remarks
Sets an horizontal line that can be an underline or a strikethrough. Actually, the line can be anywhere vertically due to position parameter. Multiple call to this method will produce multiple lines.
The thickness of the line will bethickness + thicknessMul * fontSize
.
The position of the line will be
baseLine + yPosition + yPositionMul * fontSize
.
SetUnderline(Color, float, float, float, float, float, int)
Sets an horizontal line that can be an underline or a strikethrough.
public virtual T SetUnderline(Color color, float opacity, float thickness, float thicknessMul, float yPosition, float yPositionMul, int lineCapStyle)
Parameters
color
Colorthe color of the line or
null
to follow the text coloropacity
floatthe opacity of the line; a float between 0 and 1, where 1 stands for fully opaque color and 0 - for fully transparent
thickness
floatthe absolute thickness of the line
thicknessMul
floatthe thickness multiplication factor with the font size
yPosition
floatthe absolute y position relative to the baseline
yPositionMul
floatthe position multiplication factor with the font size
lineCapStyle
intthe end line cap style. Allowed values are enumerated in PdfCanvasConstants.LineCapStyle
Returns
- T
this element
Remarks
Sets an horizontal line that can be an underline or a strikethrough. Actually, the line can be anywhere vertically due to position parameter. Multiple call to this method will produce multiple lines.
The thickness of the line will bethickness + thicknessMul * fontSize
.
The position of the line will be
baseLine + yPosition + yPositionMul * fontSize
.
SetWordSpacing(float)
Defines a custom spacing distance between words of a textual element.
public virtual T SetWordSpacing(float wordSpacing)
Parameters
wordSpacing
floata floating point value
Returns
- T
this Element.
Remarks
Defines a custom spacing distance between words of a textual element. This value works exactly like the character spacing, but only kicks in at word boundaries.