Package com.itextpdf.layout.element
Class Text
- java.lang.Object
-
- com.itextpdf.commons.actions.sequence.AbstractIdentifiableElement
-
- com.itextpdf.layout.ElementPropertyContainer<T>
-
- com.itextpdf.layout.element.AbstractElement<Text>
-
- com.itextpdf.layout.element.Text
-
- All Implemented Interfaces:
IAbstractElement
,IElement
,ILeafElement
,IPropertyContainer
,IAccessibleElement
- Direct Known Subclasses:
Link
public class Text extends AbstractElement<Text> implements ILeafElement, IAccessibleElement
AText
is a piece of text of any length. As aleaf element
, it is the smallest piece of content that may bear specific layout attributes.
-
-
Field Summary
Fields Modifier and Type Field Description protected DefaultAccessibilityProperties
tagProperties
protected java.lang.String
text
-
Fields inherited from class com.itextpdf.layout.element.AbstractElement
childElements, nextRenderer, styles
-
Fields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
-
Constructor Summary
Constructors Constructor Description Text(java.lang.String text)
Constructs a Text with its role initialized.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessibilityProperties
getAccessibilityProperties()
Gets theaccessibility properties
.java.lang.Float
getHorizontalScaling()
Gets the horizontal scaling property, which determines how wide the text should be stretched.java.lang.String
getText()
Gets the contents of the Text object that will be rendered.float
getTextRise()
Gets the text rise.protected IRenderer
makeNewRenderer()
Creates new renderer instance.Text
setHorizontalScaling(float horizontalScaling)
The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction.Text
setNeutralRole()
Give this element a neutral role.Text
setSkew(float alpha, float beta)
Skews the text to simulate italic and other effects.void
setText(java.lang.String text)
Sets the contents of the Text object.Text
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, setBold, 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, setItalic, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing
-
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 Detail
-
text
protected java.lang.String text
-
tagProperties
protected DefaultAccessibilityProperties tagProperties
-
-
Method Detail
-
getText
public java.lang.String getText()
Gets the contents of the Text object that will be rendered.- Returns:
- the string with the contents
-
setText
public void setText(java.lang.String text)
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
public Text setTextRise(float textRise)
Sets the text rise.- Parameters:
textRise
- a vertical distance from the text's default base line.- Returns:
- this Text
-
getHorizontalScaling
public java.lang.Float getHorizontalScaling()
Gets the horizontal scaling property, which determines how wide the text should be stretched.- Returns:
- the horizontal spacing, as a
float
-
setSkew
public Text setSkew(float alpha, float beta)
Skews the text to simulate italic and other effects. Tryalpha=0
andbeta=12
.- Parameters:
alpha
- the first angle in degreesbeta
- the second angle in degrees- Returns:
- this
Text
-
setHorizontalScaling
public Text setHorizontalScaling(float horizontalScaling)
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
public AccessibilityProperties 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
public Text setNeutralRole()
Give this element a neutral role. See alsoAccessibilityProperties.setRole(String)
.- Returns:
- this Element
-
makeNewRenderer
protected IRenderer makeNewRenderer()
Description copied from class:AbstractElement
Creates new renderer instance.- Specified by:
makeNewRenderer
in classAbstractElement<Text>
- Returns:
- new
IRenderer
-
-