Package com.itextpdf.layout.element
Class Text
- All Implemented Interfaces:
-
IAbstractElement
,IElement
,ILeafElement
,IPropertyContainer
,IAccessibleElement
- Direct Known Subclasses:
-
Link
A
Text
is a piece of text of any length. As a leaf element
, it is the smallest piece of content that may bear specific layout attributes.
-
Field Summary
Fields inherited from class com.itextpdf.layout.element.AbstractElement
childElements, nextRenderer, styles
Fields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets theaccessibility properties
.Gets the horizontal scaling property, which determines how wide the text should be stretched.getText()
Gets the contents of the Text object that will be rendered.float
Gets the text rise.protected IRenderer
Creates new renderer instance.setHorizontalScaling
(float horizontalScaling) The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction.Give this element a neutral role.setSkew
(float alpha, float beta) Skews the text to simulate italic and other effects.void
Sets the contents of the Text object.setTextRise
(float textRise) Sets the text rise.Methods inherited from class com.itextpdf.layout.element.AbstractElement
addStyle, createRendererSubTree, getChildren, getProperty, getRenderer, hasProperty, isEmpty, setAction, setNextRenderer, setPageNumber
Methods inherited from class com.itextpdf.layout.ElementPropertyContainer
deleteOwnProperty, getDefaultProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, hasOwnProperty, 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, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalic
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.itextpdf.layout.element.IElement
createRendererSubTree, getRenderer, setNextRenderer
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getDefaultProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
-
Field Details
-
text
-
tagProperties
-
-
Constructor Details
-
Text
Constructs a Text with its role initialized.- Parameters:
-
text
- the contents, as aString
-
-
Method Details
-
getText
Gets the contents of the Text object that will be rendered.- Returns:
- the string with the contents
-
setText
Sets the contents of the Text object.- Parameters:
-
text
- the new contents
-
getTextRise
public float getTextRise()Gets the text rise.- Returns:
- the vertical distance from the text's default base line, as a float.
-
setTextRise
Sets the text rise.- Parameters:
-
textRise
- a vertical distance from the text's default base line. - Returns:
- this Text
-
getHorizontalScaling
Gets the horizontal scaling property, which determines how wide the text should be stretched.- Returns:
-
the horizontal spacing, as a
float
-
setSkew
Skews the text to simulate italic and other effects. Tryalpha=0
andbeta=12
.- Parameters:
-
alpha
- the first angle in degrees -
beta
- the second angle in degrees - Returns:
-
this
Text
-
setHorizontalScaling
The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction.- Parameters:
-
horizontalScaling
- the scaling parameter. 1 means no scaling will be applied, 0.5 means the text will be scaled by half. 2 means the text will be twice as wide as normal one. - Returns:
- this Text
-
getAccessibilityProperties
Description copied from interface:IAccessibleElement
Gets theaccessibility properties
. See alsoIAccessibleElement
.- Specified by:
-
getAccessibilityProperties
in interfaceIAccessibleElement
- Returns:
- an interface that allows to specify properties of a tagged element in Tagged PDF.
-
setNeutralRole
Give this element a neutral role. See alsoAccessibilityProperties.setRole(String)
.- Returns:
- this Element
-
makeNewRenderer
Description copied from class:AbstractElement
Creates new renderer instance.- Specified by:
-
makeNewRenderer
in classAbstractElement<Text>
- Returns:
-
new
IRenderer
-