FormattedText
Overview
FormattedText is a class in Aspose.PDF FOSS for .NET.
Represents formatted text used in stamp and mend operations.
This class declares 26 methods for FormattedText objects in .NET programs.
Available methods include: AddNewLineText, FormattedText, IsCjk, SetCjkFontStyle.
Public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: BackgroundColor, CustomFontFile, FontName, FontSize, ForegroundColor, IsEmbedded, and 3 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
Text | string | Read | The first line text content. |
FontSize | double | Read/Write | Font size in points. |
FontName | string | Read/Write | Font name (PDF base font name). |
ForegroundColor | Color | Read/Write | Foreground (text) color. |
BackgroundColor | Color | Read/Write | Background color. |
IsEmbedded | bool | Read/Write | Whether the text is embedded (for non-standard fonts). |
CustomFontFile | string? | Read/Write | Custom font file path (for TrueType font embedding). |
TextWidth | float | Read | Advance width of the text at the current font and size, in points. |
TextHeight | float | Read | Height of the formatted text, in points. |
Methods
| Signature | Description |
|---|---|
FormattedText() | Create a new FormattedText with empty text. |
FormattedText(text: string) | Create a new FormattedText with the specified text. |
FormattedText(text: string, foregroundColor: Color, backgroundColor: Color) | Create a FormattedText with text and foreground/background colors. |
FormattedText(text: string, foregroundColor: FontColor) | Create a FormattedText with text and FontColor foreground/background. |
FormattedText(text: string, foregroundColor: FontColor, backgroundColor: FontColor) | Create a FormattedText with text and FontColor foreground/background. |
FormattedText(text: string, fontColor: FontColor, fontStyle: FontStyle, encodingType: EncodingType, embedded: bool, textSize: float) | Create a FormattedText with full formatting using FontColor. |
FormattedText(text: string, textColor: FontColor, backColor: FontColor, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float) | Create a FormattedText with full formatting using FontColor with foreground and background. |
FormattedText(text: string, fontColor: FontColor, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | Create a FormattedText with full formatting using FontColor, with line spacing. |
FormattedText(text: string, textColor: Color, backColor: Color, fontName: string, textEncoding: EncodingType, embedded: bool, fontSize: float) | Create a FormattedText with System.Drawing.Color foreground/background and font settings. |
FormattedText(text: string, textColor: Color, backColor: Color, textFont: FontStyle, encoding: EncodingType, embedded: bool, textSize: float) | Create a FormattedText with System.Drawing.Color foreground/background and FontStyle. |
FormattedText(text: string, textColor: Color, backColor: Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | Creates a single line of text with the given text and background colors, standard font, embedding flag, font size in points and line spacing in points. |
FormattedText(text: string, textColor: System.Drawing.Color, backColor: System.Drawing.Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | Creates a single line of text with System.Drawing.Color text and background colors, standard font, embedding flag, font size in points and line spacing in points. |
FormattedText(text: string, textColor: FontColor, backColor: FontColor, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | Creates a single line of text with FontColor text and background colors, standard font, embedding flag, font size in points and line spacing in points. |
FormattedText(text: string, textColor: System.Drawing.Color, backColor: System.Drawing.Color) | System.Drawing.Color foreground + foreground/background pair. |
FormattedText(text: string, color: System.Drawing.Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float) | System.Drawing.Color foreground + FontStyle + EncodingType, no lineSpacing. |
FormattedText(text: string, textColor: System.Drawing.Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | System.Drawing.Color foreground + FontStyle + EncodingType + lineSpacing. |
FormattedText(text: string, textColor: System.Drawing.Color, backColor: System.Drawing.Color, textFont: FontStyle, encoding: EncodingType, embedded: bool, textSize: float) | System.Drawing.Color foreground/background + FontStyle. |
FormattedText(text: string, textColor: System.Drawing.Color, backColor: System.Drawing.Color, fontName: string, textEncoding: EncodingType, embedded: bool, fontSize: float) | System.Drawing.Color foreground/background + font-name string. |
FormattedText(text: string, textColor: System.Drawing.Color, fontName: string, textEncoding: EncodingType, embedded: bool, fontSize: float) | Create a FormattedText with System.Drawing.Color foreground and a font name or TrueType font file. |
FormattedText(text: string, textColor: Color, fontName: string, textEncoding: EncodingType, embedded: bool, fontSize: float) | Create a FormattedText with Aspose.Pdf.Color foreground and a font name or TrueType font file. |
FormattedText(text: string, color: Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float) | Create a FormattedText with FontStyle (enum) and System.Drawing.Color. |
FormattedText(text: string, textColor: Color, textFont: FontStyle, textEncoding: EncodingType, embedded: bool, textSize: float, lineSpacing: float) | Create a FormattedText with Aspose.Pdf.Color foreground/background and a line spacing. |
AddNewLineText(newLineText: string) | Add a new line of text. |
AddNewLineText(newLineText: string, lineSpacing: float) | Add a new line of text with custom line spacing. |
IsCjk() | Check if the text contains CJK characters. |
SetCjkFontStyle() | Set the font to a CJK-capable font (MS Gothic equivalent). |