Package com.evopdf
Class TextElement
java.lang.Object
com.evopdf.PageElement
com.evopdf.PageGraphicElement
com.evopdf.TextElement
Represents a text element to be added to a PDF page or template
-
Constructor Summary
ConstructorsConstructorDescriptionTextElement
(float x, float y, float width, float height, String text, PdfFont font) Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified width, height and font.TextElement
(float x, float y, float width, float height, String text, PdfFont font, RgbColor textColor) Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified width, height, font and color.TextElement
(float x, float y, float width, String text, PdfFont font) Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified width and font.TextElement
(float x, float y, float width, String text, PdfFont font, RgbColor textColor) Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified width, font and color.TextElement
(float x, float y, String text, PdfFont font) Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified font.TextElement
(float x, float y, String text, PdfFont font, RgbColor textColor) Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified font and color. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Gets the additional spacing between charactersboolean
Gets the flag indicating if the font associated with this text element should be embedded in the generated PDF documentfloat
height()
Gets the height of destination rectangle in PDF where this text element will be renderedfloat
Gets the value that indicates the vertical distance between the baselines of adjacent lines of textboolean
paginate()
Gets the flag indicating if the text can be paginated to render many PDF pages if necessaryboolean
Gets the flag indicating if the text is in a RTL languagevoid
setCharacterSpacing
(float characterSpacing) Sets the additional spacing between charactersvoid
setEmbedSysFont
(boolean embedSysFont) Sets the flag indicating if the font associated with this text element should be embedded in the generated PDF documentvoid
setHeight
(float height) Sets the height of destination rectangle in PDF where this text element will be renderedvoid
setLineSpacing
(float leading) Sets the value that indicates the vertical distance between the baselines of adjacent lines of textvoid
setPaginate
(boolean paginate) Sets the flag indicating if the text can be paginated to render many PDF pages if necessaryvoid
setRightToLeftLanguage
(boolean rightToLeft) Sets the flag indicating if the text is in a RTL languagevoid
Sets the text to be writtenvoid
setTextAlign
(HorizontalTextAlign textAlign) Sets the horizontal alignment of the text rendered by this element in PDFvoid
setTextAngle
(float textAngle) Sets the angle to control text counter-clockwise direction.void
setTextFont
(PdfFont pdfFont) Sets the font of the text rendered by this element in PDFvoid
setTextRise
(float textRise) Sets the distance to move the text baseline up or down from its default location.void
setVerticalTextAlign
(VerticalTextAlign verticalTextAlign) Sets the vertical alignment of the text rendered by this element in PDFvoid
setWidth
(float width) Sets the width of destination rectangle in PDF where this text element will be renderedvoid
setWordSpacing
(float wordSpacing) Sets the additional spacing between words.void
setX
(float x) Sets the start X position of this element relative to the PDF elements containervoid
setY
(float y) Sets the start Y position of this element relative to the PDF elements containertext()
Gets the text to be writtenGets the horizontal alignment of the text rendered by this element in PDFfloat
Gets the angle to control text counter-clockwise directiontextFont()
Gets the font of the text rendered by this element in PDFfloat
textRise()
Gets the distance to move the text baseline up or down from its default locationGets the vertical alignment of the text rendered by this element in PDFfloat
width()
Gets the width of destination rectangle in PDF where this text element will be renderedfloat
Gets the additional spacing between wordsfloat
x()
Gets the start X position of this element relative to the PDF elements containerfloat
y()
Gets the start Y position of this element relative to the PDF elements containerMethods inherited from class com.evopdf.PageGraphicElement
backColor, blending, clipRectangle, foreColor, gradient, lineStyle, opacity, rotate, scale, setBackColor, setBlending, setClipRectangle, setForeColor, setGradient, setLineStyle, setOpacity, skew, translate
-
Constructor Details
-
TextElement
Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified font. The height of the rendered text will be auto-determined. The width is the available width in page. The Unicode text is supported only for embedded true type fonts. A flag indicating if the font is embedded or not in PDF can be specified when the font is added to PDF document. If the text pagination is not allowed (paginate()
property is false ), the text will be written on current page, the rendered text height being limited by the available height on page. If the text pagination is allowed (paginate()
property is true ) and the text needs pagination (the auto-determined text height is bigger than the available space on page), all the text will be rendered using the necessary height- Parameters:
x
- the start x coordinate where the text will be renderedy
- the start y coordinate where the texttext
- the text to be renderedfont
- the text font. The true type fonts must be embedded in PDF when it is added to the document in order to support Unicode texts
-
TextElement
Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified font and color. The height of the rendered text will be auto-determined. The width is the available width in page. The Unicode text is supported only for embedded true type fonts. A flag indicating if the font is embedded or not in PDF can be specified when the font is added to PDF document. If the text pagination is not allowed (paginate()
property is false ), the text will be written on current page, the rendered text height being limited by the available height on page. If the text pagination is allowed (paginate()
property is true ) and the text needs pagination (the auto-determined text height is bigger than the available space on page), all the text will be rendered using the necessary height- Parameters:
x
- the start x coordinate where the text will be renderedy
- the start y coordinate where the texttext
- the text to be renderedfont
- the text font. The true type fonts must be embedded in PDF when it is added to the document in order to support Unicode textstextColor
- the text color
-
TextElement
Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified width and font. The height of the rendered text will be auto-determined. The width is the available width in page. The Unicode text is supported only for embedded true type fonts. A flag indicating if the font is embedded or not in PDF can be specified when the font is added to PDF document. If the text pagination is not allowed (paginate()
property is false ), the text will be written on current page, the rendered text height being limited by the available height on page. If the text pagination is allowed (paginate()
property is true ) and the text needs pagination (the auto-determined text height is bigger than the available space on page), all the text will be rendered using the necessary height- Parameters:
x
- the start x coordinate where the text will be renderedy
- the start y coordinate where the textwidth
- the width of the destination rectangle. Use a negative value allow text to flow freely in PDF page widthtext
- the text to be renderedfont
- the text font. The true type fonts must be embedded in PDF when it is added to the document in order to support Unicode texts
-
TextElement
Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified width, height and font. The height of the rendered text will be auto-determined. The width is the available width in page. The Unicode text is supported only for embedded true type fonts. A flag indicating if the font is embedded or not in PDF can be specified when the font is added to PDF document. If the text pagination is not allowed (paginate()
property is false ), the text will be written on current page, the rendered text height being limited by the available height on page. If the text pagination is allowed (paginate()
property is true ) and the text needs pagination (the auto-determined text height is bigger than the available space on page), all the text will be rendered using the necessary height.- Parameters:
x
- the start x coordinate where the text will be renderedy
- the start y coordinate where the textwidth
- the width of the destination rectangle. Use a negative value allow text to flow freely in PDF page widthheight
- the height of the destination rectangle. Use a negative value allow text to flow freely in PDF documenttext
- the text to be renderedfont
- the text font. The true type fonts must be embedded in PDF when it is added to the document in order to support Unicode texts
-
TextElement
Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified width, font and color. The height of the rendered text will be auto-determined. The width is the available width in page. The Unicode text is supported only for embedded true type fonts. A flag indicating if the font is embedded or not in PDF can be specified when the font is added to PDF document. If the text pagination is not allowed (paginate()
property is false ), the text will be written on current page, the rendered text height being limited by the available height on page. If the text pagination is allowed (paginate()
property is true ) and the text needs pagination (the auto-determined text height is bigger than the available space on page), all the text will be rendered using the necessary height- Parameters:
x
- the start x coordinate where the text will be renderedy
- the start y coordinate where the textwidth
- the width of the destination rectangle. Use a negative value allow text to flow freely in PDF page widthtext
- the text to be renderedfont
- the text font. The true type fonts must be embedded in PDF when it is added to the document in order to support Unicode textstextColor
- the text color
-
TextElement
public TextElement(float x, float y, float width, float height, String text, PdfFont font, RgbColor textColor) Constructs a paginable text element that will be rendered at the specified (x,y) position using the specified width, height, font and color. The height of the rendered text will be auto-determined. The width is the available width in page. The Unicode text is supported only for embedded true type fonts. A flag indicating if the font is embedded or not in PDF can be specified when the font is added to PDF document. If the text pagination is not allowed (paginate()
property is false ), the text will be written on current page, the rendered text height being limited by the available height on page. If the text pagination is allowed (paginate()
property is true ) and the text needs pagination (the auto-determined text height is bigger than the available space on page), all the text will be rendered using the necessary height- Parameters:
x
- the start x coordinate where the text will be renderedy
- the start y coordinate where the textwidth
- the width of the destination rectangle. Use a negative value allow text to flow freely in PDF page widthheight
- the height of the destination rectangle. Use a negative value allow text to flow freely in PDF documenttext
- the text to be renderedfont
- the text font. The true type fonts must be embedded in PDF when it is added to the document in order to support Unicode textstextColor
- the text color
-
-
Method Details
-
textAlign
Gets the horizontal alignment of the text rendered by this element in PDF- Returns:
- the horizontal alignment of the text rendered by this element in PDF
-
setTextAlign
Sets the horizontal alignment of the text rendered by this element in PDF- Parameters:
textAlign
- the horizontal alignment of the text rendered by this element in PDF
-
verticalTextAlign
Gets the vertical alignment of the text rendered by this element in PDF- Returns:
- the vertical alignment of the text rendered by this element in PDF
-
setVerticalTextAlign
Sets the vertical alignment of the text rendered by this element in PDF- Parameters:
verticalTextAlign
- the vertical alignment of the text rendered by this element in PDF
-
rightToLeftLanguage
public boolean rightToLeftLanguage()Gets the flag indicating if the text is in a RTL language- Returns:
- the flag value
-
setRightToLeftLanguage
public void setRightToLeftLanguage(boolean rightToLeft) Sets the flag indicating if the text is in a RTL language- Parameters:
rightToLeft
- the flag value to set
-
characterSpacing
public float characterSpacing()Gets the additional spacing between characters- Returns:
- the additional spacing between characters
-
setCharacterSpacing
public void setCharacterSpacing(float characterSpacing) Sets the additional spacing between characters- Parameters:
characterSpacing
- additional spacing between characters
-
wordSpacing
public float wordSpacing()Gets the additional spacing between words- Returns:
- the additional spacing between words
-
setWordSpacing
public void setWordSpacing(float wordSpacing) Sets the additional spacing between words. The words separator is consider the space character with code 32- Parameters:
wordSpacing
- the additional spacing between words
-
lineSpacing
public float lineSpacing()Gets the value that indicates the vertical distance between the baselines of adjacent lines of text- Returns:
- value that indicates the vertical distance between the baselines of adjacent lines of text
-
setLineSpacing
public void setLineSpacing(float leading) Sets the value that indicates the vertical distance between the baselines of adjacent lines of text- Parameters:
leading
- value that indicates the vertical distance between the baselines of adjacent lines of text
-
textAngle
public float textAngle()Gets the angle to control text counter-clockwise direction- Returns:
- the angle to control text counter-clockwise direction
-
setTextAngle
public void setTextAngle(float textAngle) Sets the angle to control text counter-clockwise direction. The default value is 0- Parameters:
textAngle
- the angle to control text counter-clockwise direction
-
textRise
public float textRise()Gets the distance to move the text baseline up or down from its default location- Returns:
- the distance to move the text baseline up or down from its default location
-
setTextRise
public void setTextRise(float textRise) Sets the distance to move the text baseline up or down from its default location. Adjustments to the baseline are useful for drawing superscripts or subscripts. Positive values of text rise move the baseline up and creates a superscript text. Negative values of text rise move the baseline down and creates a subscript text- Parameters:
textRise
- the distance to move the text baseline up or down from its default location
-
text
Gets the text to be written- Returns:
- the text to be written
-
setText
Sets the text to be written- Parameters:
text
- the text to be written
-
x
public float x()Gets the start X position of this element relative to the PDF elements container- Returns:
- the start X position of this element relative to the PDF elements container
-
setX
public void setX(float x) Sets the start X position of this element relative to the PDF elements container- Parameters:
x
- the start X position of this element relative to the PDF elements container
-
y
public float y()Gets the start Y position of this element relative to the PDF elements container- Returns:
- the start Y position of this element relative to the PDF elements container
-
setY
public void setY(float y) Sets the start Y position of this element relative to the PDF elements container- Parameters:
y
- the start Y position of this element relative to the PDF elements container
-
width
public float width()Gets the width of destination rectangle in PDF where this text element will be rendered- Returns:
- the width of destination rectangle in PDF where this text element will be rendered
-
setWidth
public void setWidth(float width) Sets the width of destination rectangle in PDF where this text element will be rendered- Parameters:
width
- the width of destination rectangle in PDF where this text element will be rendered
-
height
public float height()Gets the height of destination rectangle in PDF where this text element will be rendered- Returns:
- the height of destination rectangle in PDF where this text element will be rendered
-
setHeight
public void setHeight(float height) Sets the height of destination rectangle in PDF where this text element will be rendered- Parameters:
height
- the height of destination rectangle in PDF where this text element will be rendered
-
textFont
Gets the font of the text rendered by this element in PDF- Returns:
- the font of the text rendered by this element in PDF
-
setTextFont
Sets the font of the text rendered by this element in PDF- Parameters:
pdfFont
- the font of the text rendered by this element in PDF
-
embedSysFont
public boolean embedSysFont()Gets the flag indicating if the font associated with this text element should be embedded in the generated PDF document- Returns:
- the flag indicating if the font associated with this text element should be embedded in the generated PDF document
-
setEmbedSysFont
public void setEmbedSysFont(boolean embedSysFont) Sets the flag indicating if the font associated with this text element should be embedded in the generated PDF document- Parameters:
embedSysFont
- the flag indicating if the font associated with this text element should be embedded in the generated PDF document
-
paginate
public boolean paginate()Gets the flag indicating if the text can be paginated to render many PDF pages if necessary- Returns:
- the flag value
-
setPaginate
public void setPaginate(boolean paginate) Sets the flag indicating if the text can be paginated to render many PDF pages if necessary- Parameters:
paginate
- the flag value to set
-