Package com.itextpdf.layout
Class RootElementIPropertyContainer>
java.lang.Object
com.itextpdf.commons.actions.sequence.AbstractIdentifiableElement
com.itextpdf.layout.ElementPropertyContainer
com.itextpdf.layout.RootElement
- Type Parameters:
-
T
- this type
- All Implemented Interfaces:
-
IPropertyContainer
,Closeable
,AutoCloseable
public abstract class RootElementIPropertyContainer> extends ElementPropertyContainer implements Closeable
A generic abstract root element for a PDF layout object hierarchy.
-
Field Summary
Modifier and TypeFieldDescriptionprotected PdfFont
protected FontProvider
protected ISplitCharacters
protected boolean
protected PdfDocument
protected RootRenderer
Fields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(IBlockElement element) Adds an element to the root.Adds an image to the root.protected void
createAndAddRendererSubTree
(IElement element) void
deleteOwnProperty
(int property) Deletes the own property of this entity.protected abstract RootRenderer
T1 getDefaultProperty
(int property) Gets the default property from this entity.GetsFontProvider
if presents.T1 getOwnProperty
(int property) Gets own property from this entity.T1 getProperty
(int property) Gets the property from this entity.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.void
setFontProvider
(FontProvider fontProvider) SetsFontProvider
.void
setProperty
(int property, Object value) Sets a property for this entity.showTextAligned
(Paragraph p, float x, float y, int pageNumber, TextAlignment textAlign, VerticalAlignment vertAlign, float radAngle) Convenience method to write a text aligned about the specified pointshowTextAligned
(Paragraph p, float x, float y, TextAlignment textAlign) Convenience method to write a text aligned about the specified pointshowTextAligned
(Paragraph p, float x, float y, TextAlignment textAlign, VerticalAlignment vertAlign) Convenience method to write a text aligned about the specified pointshowTextAligned
(String text, float x, float y, TextAlignment textAlign) Convenience method to write a text aligned about the specified pointshowTextAligned
(String text, float x, float y, TextAlignment textAlign, float angle) Convenience method to write a text aligned about the specified pointshowTextAligned
(String text, float x, float y, TextAlignment textAlign, VerticalAlignment vertAlign, float angle) Convenience method to write a text aligned about the specified pointshowTextAlignedKerned
(String text, float x, float y, TextAlignment textAlign, VerticalAlignment vertAlign, float radAngle) Convenience method to write a kerned text aligned about the specified pointMethods inherited from class com.itextpdf.layout.ElementPropertyContainer
getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalic
-
Field Details
-
immediateFlush
protected boolean immediateFlush -
pdfDocument
-
childElements
-
defaultFont
-
defaultFontProvider
-
defaultSplitCharacters
-
rootRenderer
-
-
Constructor Details
-
RootElement
public RootElement()
-
-
Method Details
-
add
Adds an element to the root. The element is immediately placed in the contents.- Parameters:
-
element
- an element with spacial margins, tabbing, and alignment - Returns:
- this element
- See Also:
-
add
Adds an image to the root. The element is immediately placed in the contents.- Parameters:
-
image
- a graphical image element - Returns:
- this element
- See Also:
-
getFontProvider
GetsFontProvider
if presents.- Returns:
-
instance of
FontProvider
if exists, otherwise null.
-
setFontProvider
SetsFontProvider
. Note, font provider is inherited property.- Parameters:
-
fontProvider
- instance ofFontProvider
.
-
hasProperty
public boolean hasProperty(int property) Description copied from interface:IPropertyContainer
Checks if this entity has the specified property. Compared toIPropertyContainer.hasOwnProperty(int)
, this method can check parent's properties, styles, etc, depending on the origin of the instance- Specified by:
-
hasProperty
in interfaceIPropertyContainer
- Overrides:
-
hasProperty
in classElementPropertyContainer<T extends IPropertyContainer>
- Parameters:
-
property
- the property to be checked - Returns:
-
true
if this instance has given property,false
otherwise
-
hasOwnProperty
public boolean hasOwnProperty(int property) Description copied from interface:IPropertyContainer
Checks if this entity has the specified property, i.e. if it was set to this very element earlier- Specified by:
-
hasOwnProperty
in interfaceIPropertyContainer
- Overrides:
-
hasOwnProperty
in classElementPropertyContainer<T extends IPropertyContainer>
- Parameters:
-
property
- the property to be checked - Returns:
-
true
if this instance has given own property,false
otherwise
-
getProperty
publicT1 getProperty (int property) Description copied from interface:IPropertyContainer
Gets the property from this entity. Compared toIPropertyContainer.getOwnProperty(int)
, this method can check parent's properties, styles, etc, depending on the origin of the instance- Specified by:
-
getProperty
in interfaceIPropertyContainer
- Overrides:
-
getProperty
in classElementPropertyContainer<T extends IPropertyContainer>
- Type 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
-
getOwnProperty
publicT1 getOwnProperty (int property) Description copied from interface:IPropertyContainer
Gets own property from this entity. The property must have been set earlier to this entity. If the property is not found,null
will be returned.- Specified by:
-
getOwnProperty
in interfaceIPropertyContainer
- Overrides:
-
getOwnProperty
in classElementPropertyContainer<T extends IPropertyContainer>
- Type Parameters:
-
T1
- the return type associated with the property - Parameters:
-
property
- the property to be retrieved - Returns:
-
the value of the given own property.
null
will be returned if the property value was not found
-
getDefaultProperty
publicT1 getDefaultProperty (int property) Description copied from interface:IPropertyContainer
Gets the default property from this entity.- Specified by:
-
getDefaultProperty
in interfaceIPropertyContainer
- Overrides:
-
getDefaultProperty
in classElementPropertyContainer<T extends IPropertyContainer>
- Type Parameters:
-
T1
- the return type associated with the property - Parameters:
-
property
- the property to be retrieved - Returns:
-
the default property value. If the default property is not defined,
null
will be returned
-
deleteOwnProperty
public void deleteOwnProperty(int property) Description copied from interface:IPropertyContainer
Deletes the own property of this entity.- Specified by:
-
deleteOwnProperty
in interfaceIPropertyContainer
- Overrides:
-
deleteOwnProperty
in classElementPropertyContainer<T extends IPropertyContainer>
- Parameters:
-
property
- the property to be deleted
-
setProperty
Description copied from interface:IPropertyContainer
Sets a property for this entity.- Specified by:
-
setProperty
in interfaceIPropertyContainer
- Overrides:
-
setProperty
in classElementPropertyContainer<T extends IPropertyContainer>
- Parameters:
-
property
- the property to be set -
value
- the value of the property
-
getRenderer
Gets the rootRenderer attribute, a specializedIRenderer
that acts as the root object that otherrenderers
descend from.- Returns:
-
the
RootRenderer
attribute
-
showTextAligned
Convenience method to write a text aligned about the specified point- Parameters:
-
text
- text to be placed to the page -
x
- the point about which the text will be aligned and rotated -
y
- the point about which the text will be aligned and rotated -
textAlign
- horizontal alignment about the specified point - Returns:
- this object
-
showTextAligned
Convenience method to write a text aligned about the specified point- Parameters:
-
text
- text to be placed to the page -
x
- the point about which the text will be aligned and rotated -
y
- the point about which the text will be aligned and rotated -
textAlign
- horizontal alignment about the specified point -
angle
- the angle of rotation applied to the text, in radians - Returns:
- this object
-
showTextAligned
public T showTextAligned(String text, float x, float y, TextAlignment textAlign, VerticalAlignment vertAlign, float angle) Convenience method to write a text aligned about the specified point- Parameters:
-
text
- text to be placed to the page -
x
- the point about which the text will be aligned and rotated -
y
- the point about which the text will be aligned and rotated -
textAlign
- horizontal alignment about the specified point -
vertAlign
- vertical alignment about the specified point -
angle
- the angle of rotation applied to the text, in radians - Returns:
- this object
-
showTextAlignedKerned
public T showTextAlignedKerned(String text, float x, float y, TextAlignment textAlign, VerticalAlignment vertAlign, float radAngle) Convenience method to write a kerned text aligned about the specified point- Parameters:
-
text
- text to be placed to the page -
x
- the point about which the text will be aligned and rotated -
y
- the point about which the text will be aligned and rotated -
textAlign
- horizontal alignment about the specified point -
vertAlign
- vertical alignment about the specified point -
radAngle
- the angle of rotation applied to the text, in radians - Returns:
- this object
-
showTextAligned
Convenience method to write a text aligned about the specified point- Parameters:
-
p
- paragraph of text to be placed to the page. By default it has no leading and is written in single line. Set width to write multiline text. -
x
- the point about which the text will be aligned and rotated -
y
- the point about which the text will be aligned and rotated -
textAlign
- horizontal alignment about the specified point - Returns:
- this object
-
showTextAligned
public T showTextAligned(Paragraph p, float x, float y, TextAlignment textAlign, VerticalAlignment vertAlign) Convenience method to write a text aligned about the specified point- Parameters:
-
p
- paragraph of text to be placed to the page. By default it has no leading and is written in single line. Set width to write multiline text. -
x
- the point about which the text will be aligned and rotated -
y
- the point about which the text will be aligned and rotated -
textAlign
- horizontal alignment about the specified point -
vertAlign
- vertical alignment about the specified point - Returns:
- this object
-
showTextAligned
public T showTextAligned(Paragraph p, float x, float y, int pageNumber, TextAlignment textAlign, VerticalAlignment vertAlign, float radAngle) Convenience method to write a text aligned about the specified point- Parameters:
-
p
- paragraph of text to be placed to the page. By default it has no leading and is written in single line. Set width to write multiline text. -
x
- the point about which the text will be aligned and rotated -
y
- the point about which the text will be aligned and rotated -
pageNumber
- the page number to write the text -
textAlign
- horizontal alignment about the specified point -
vertAlign
- vertical alignment about the specified point -
radAngle
- the angle of rotation applied to the text, in radians - Returns:
- this object
-
ensureRootRendererNotNull
-
createAndAddRendererSubTree
-