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.
This class provides 22 methods for working with FormattedText objects in Java programs.
Available methods include: FormattedText, addNewLineText, getBackColor, getEncoding, getFirstLine, getFontName, getFontSize, getFontStyle, getLineSpacing, getText, getTextColor, isEmbedded, and 1 additional methods.
All public members are accessible to any Java application after installing the Aspose.PDF FOSS for Java package.
Properties: backColor, embedded, encoding, firstLine, fontName, fontSize, and 4 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
firstLine | String | Read | Returns the first line of text, or an empty string if no text has been set. |
text | String | Read | Returns all lines of text joined by newline characters. |
textColor | Color | Read | Returns the foreground (text) color. |
backColor | Color | Read | Returns the background color. |
fontName | String | Read | Returns the font name. |
fontSize | float | Read | Returns the font size in points. |
embedded | boolean | Read | Returns whether the font should be embedded in the PDF. |
fontStyle | FontStyle | Read | Returns the predefined font style. |
encoding | EncodingType | Read | Returns the encoding type. |
lineSpacing | float | Read | Returns the line spacing in points. |
Methods
| Signature | Description |
|---|---|
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() → String | Returns the first line of text, or an empty string if no text has been set. |
getText() → String | Returns all lines of text joined by newline characters. |
getTextColor() → Color | Returns the foreground (text) color. |
getBackColor() → Color | Returns the background color. |
getFontName() → String | Returns the font name. |
getFontSize() → float | Returns the font size in points. |
isEmbedded() → boolean | Returns whether the font should be embedded in the PDF. |
getFontStyle() → FontStyle | Returns the predefined font style. |
getEncoding() → EncodingType | Returns the encoding type. |
getLineSpacing() → float | Returns the line spacing in points. |
toString() → String |