FormattedText

FormattedText

Overview

FormattedText is a class in Aspose.Pdf FOSS for Java.

Represents formatted text with font, color, and encoding properties, used primarily for stamps in the facades API.

Properties

NameTypeAccessDescription
firstLineStringReadReturns the first line of text, or an empty string if no text has been set.
textStringReadReturns all lines of text joined by newline characters.
textColorColorReadReturns the foreground (text) color.
backColorColorReadReturns the background color.
fontNameStringReadReturns the font name.
fontSizefloatReadReturns the font size in points.
embeddedbooleanReadReturns whether the font should be embedded in the PDF.
fontStyleFontStyleReadReturns the predefined font style.
encodingEncodingTypeReadReturns the encoding type.
lineSpacingfloatReadReturns the line spacing in points.

Methods

SignatureDescription
FormattedText()Creates an empty {@code FormattedText} instance.
FormattedText(text: String)Creates a {@code FormattedText} with the given text.
FormattedText(text: String, foregroundColor: Color, backgroundColor: Color)Creates a {@code FormattedText} with foreground and background colors.
FormattedText(text: String, color: Color, fontStyle: FontStyle, encoding: EncodingType, embedded: boolean, fontSize: float)Creates a {@code FormattedText} with color, font style, encoding, and size.
FormattedText(text: String, color: Color, fontName: String, encoding: EncodingType, embedded: boolean, fontSize: float)Creates a {@code FormattedText} with color, font name, encoding, and size.
FormattedText(text: String, foregroundColor: Color, backgroundColor: Color, fontStyle: FontStyle, encoding: EncodingType, embedded: boolean, fontSize: float)Creates a {@code FormattedText} with foreground/background colors, font style, encoding, and size.
FormattedText(text: String, foregroundColor: Color, backgroundColor: Color, fontName: String, encoding: EncodingType, embedded: boolean, fontSize: float)Creates a {@code FormattedText} with foreground/background colors, font name, encoding, and size.
FormattedText(text: String, color: Color, fontStyle: FontStyle, encoding: EncodingType, embedded: boolean, fontSize: float, lineSpacing: float)Creates a {@code FormattedText} with color, font style, encoding, size, and line spacing.
FormattedText(text: String, foregroundColor: Color, backgroundColor: Color, fontStyle: FontStyle, encoding: EncodingType, embedded: boolean, fontSize: float, lineSpacing: float)Creates a {@code FormattedText} with foreground/background colors, font style, encoding, size, and line spacing.
addNewLineText(text: String)Adds a new line of text.
addNewLineText(text: String, lineSpacing: float)Adds a new line of text with custom line spacing.
getFirstLine()StringReturns the first line of text, or an empty string if no text has been set.
getText()StringReturns all lines of text joined by newline characters.
getTextColor()ColorReturns the foreground (text) color.
getBackColor()ColorReturns the background color.
getFontName()StringReturns the font name.
getFontSize()floatReturns the font size in points.
isEmbedded()booleanReturns whether the font should be embedded in the PDF.
getFontStyle()FontStyleReturns the predefined font style.
getEncoding()EncodingTypeReturns the encoding type.
getLineSpacing()floatReturns the line spacing in points.
toString()String

See Also