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
FieldsModifier and TypeFieldDescriptionprotected PdfFontprotected FontProviderprotected ISplitCharactersprotected booleanprotected PdfDocumentprotected RootRendererFields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(IBlockElement element) Adds an element to the root.Adds an image to the root.protected voidcreateAndAddRendererSubTree(IElement element) voiddeleteOwnProperty(int property) Deletes the own property of this entity.protected abstract RootRendererprotected final voidEnsures that the root tag is created in the tagging structure.T1 getDefaultProperty(int property) Gets the default property from this entity.GetsFontProviderif presents.T1 getOwnProperty(int property) Gets own property from this entity.T1 getProperty(int property) Gets the property from this entity.booleanhasOwnProperty(int property) Checks if this entity has the specified property, i.e.booleanhasProperty(int property) Checks if this entity has the specified property.voidsetFontProvider(FontProvider fontProvider) SetsFontProvider.voidsetProperty(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, getTransparentStrokeColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDashPattern, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalic
-
Field Details
-
immediateFlush
protected boolean immediateFlush -
pdfDocument
-
childElements
-
defaultFont
-
defaultFontProvider
-
defaultSplitCharacters
-
rootRenderer
-
-
Constructor Details
-
RootElement
public RootElement()Creates a newRootElementinstance.
-
-
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
GetsFontProviderif presents.- Returns:
-
instance of
FontProviderif 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:IPropertyContainerChecks 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:
-
hasPropertyin interfaceIPropertyContainer - Overrides:
-
hasPropertyin classElementPropertyContainer<T extends IPropertyContainer> - Parameters:
-
property- the property to be checked - Returns:
-
trueif this instance has given property,falseotherwise
-
hasOwnProperty
public boolean hasOwnProperty(int property) Description copied from interface:IPropertyContainerChecks if this entity has the specified property, i.e. if it was set to this very element earlier- Specified by:
-
hasOwnPropertyin interfaceIPropertyContainer - Overrides:
-
hasOwnPropertyin classElementPropertyContainer<T extends IPropertyContainer> - Parameters:
-
property- the property to be checked - Returns:
-
trueif this instance has given own property,falseotherwise
-
getProperty
publicT1 getProperty (int property) Description copied from interface:IPropertyContainerGets 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:
-
getPropertyin interfaceIPropertyContainer - Overrides:
-
getPropertyin 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.
nullwill be returned if the property value was not found
-
getOwnProperty
publicT1 getOwnProperty (int property) Description copied from interface:IPropertyContainerGets own property from this entity. The property must have been set earlier to this entity. If the property is not found,nullwill be returned.- Specified by:
-
getOwnPropertyin interfaceIPropertyContainer - Overrides:
-
getOwnPropertyin 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.
nullwill be returned if the property value was not found
-
getDefaultProperty
publicT1 getDefaultProperty (int property) Description copied from interface:IPropertyContainerGets the default property from this entity.- Specified by:
-
getDefaultPropertyin interfaceIPropertyContainer - Overrides:
-
getDefaultPropertyin 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,
nullwill be returned
-
deleteOwnProperty
public void deleteOwnProperty(int property) Description copied from interface:IPropertyContainerDeletes the own property of this entity.- Specified by:
-
deleteOwnPropertyin interfaceIPropertyContainer - Overrides:
-
deleteOwnPropertyin classElementPropertyContainer<T extends IPropertyContainer> - Parameters:
-
property- the property to be deleted
-
setProperty
Description copied from interface:IPropertyContainerSets a property for this entity.- Specified by:
-
setPropertyin interfaceIPropertyContainer - Overrides:
-
setPropertyin classElementPropertyContainer<T extends IPropertyContainer> - Parameters:
-
property- the property to be set -
value- the value of the property
-
getRenderer
Gets the rootRenderer attribute, a specializedIRendererthat acts as the root object that otherrenderersdescend from.- Returns:
-
the
RootRendererattribute
-
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
-
ensureRootTagIsCreated
protected final void ensureRootTagIsCreated()Ensures that the root tag is created in the tagging structure.
-