com.aspose.pdf.facades

Class FormattedText



  • public final class FormattedText
    extends Object

    Class which represents formatted text. Contains information about text and its color, size, style.

    • Field Detail

      • mpCustomLineSpacing

        public com.aspose.ms.System.Collections.Generic.Dictionary<Integer,Float> mpCustomLineSpacing
        For Internal usage only
    • Constructor Detail

      • FormattedText

        public FormattedText()

        Initializes FormattedText.

      • FormattedText

        public FormattedText(String text)

        Initializes FormattedText.

        Parameters:
        text - Text which contained in FormattedText.
      • FormattedText

        public FormattedText(String text,
                             FontColor fontColor,
                             int fontStyle,
                             int encodingType,
                             boolean embedded,
                             float textSize)

        Initializes FormattedText.

        Parameters:
        text - Text content of the string.
        fontColor - Color of the text.
        fontStyle - Style of the text.
        encodingType - Encoding type (value of EncodingType enumeration).
        embedded - True if the font will be embedded.
        textSize - Size of the text.
        See Also:
        FontStyle, EncodingType
      • FormattedText

        public FormattedText(String text,
                             FontColor fontColor,
                             int textFont,
                             int textEncoding,
                             boolean embedded,
                             float textSize,
                             float lineSpacing)

        Initialize FormattedText.

        Parameters:
        text - Text content of the string.
        fontColor - Color of the text.
        textFont - Font of the text.
        textEncoding - Encoding of the text.
        embedded - True if text will be embedded.
        textSize - Size of the text.
        lineSpacing - Additional spacing.
        See Also:
        FontStyle, EncodingType
      • FormattedText

        public FormattedText(String text,
                             Color color,
                             int textFont,
                             int textEncoding,
                             boolean embedded,
                             float textSize)

        Initializes FormattedText.

        Parameters:
        text - Text content of the string.
        color - Color of the text.
        textFont - Font of the text.
        textEncoding - Encoding of the text.
        embedded - True if text will be embedded.
        textSize - Size of the text.
        See Also:
        FontStyle, EncodingType
      • FormattedText

        public FormattedText(String text,
                             Color textColor,
                             int textFont,
                             int textEncoding,
                             boolean embedded,
                             float textSize,
                             float lineSpacing)

        Initializes FormattedText.

        Parameters:
        text - Text contents of the string.
        textColor - Color of the text.
        textFont - Font of the text.
        textEncoding - Encoding of the text.
        embedded - If true font will be embedded.
        textSize - Size of the text.
        lineSpacing - Additional spacing.
        See Also:
        FontStyle, EncodingType
      • FormattedText

        public FormattedText(String text,
                             FontColor textColor,
                             FontColor backColor,
                             int textFont,
                             int textEncoding,
                             boolean embedded,
                             float textSize)

        Initializes FormattedText.

        Parameters:
        text - Text content of the string.
        textColor - Color of the text.
        backColor - Color of background.
        textFont - Font of the text.
        textEncoding - Encoding of the text.
        embedded - If true font will be embedded.
        textSize - Size of the text.
        See Also:
        FontStyle, EncodingType
      • FormattedText

        public FormattedText(String text,
                             FontColor textColor,
                             FontColor backColor,
                             int textFont,
                             int textEncoding,
                             boolean embedded,
                             float textSize,
                             float lineSpacing)

        Initializes FormattedText.

        Parameters:
        text - Text content.
        textColor - Color of the text.
        backColor - Color of background.
        textFont - Font of the text.
        textEncoding - Encoding of the text.
        embedded - If true font will be embedded.
        textSize - Size of the text.
        lineSpacing - Additional spacing.
        See Also:
        FontStyle, EncodingType
      • FormattedText

        public FormattedText(String text,
                             Color textColor,
                             Color backColor,
                             int textFont,
                             int encoding,
                             boolean embedded,
                             float textSize)

        Initializes FormattedText.

        Parameters:
        text - Text content of the string.
        textColor - Color of the text.
        backColor - Color of background.
        textFont - Font of the text.
        encoding - Encoding of the text.
        embedded - True if font will be embedded.
        textSize - Size of the text.
        See Also:
        FontStyle, EncodingType
      • FormattedText

        public FormattedText(String text,
                             Color textColor,
                             Color backColor,
                             int textFont,
                             int textEncoding,
                             boolean embedded,
                             float textSize,
                             float lineSpacing)

        Initializes FormattedText.

        Parameters:
        text - Text contents of the string.
        textColor - Color of the text.
        backColor - Color of the background.
        textFont - Font of the text.
        textEncoding - Encoding of the text.
        embedded - If true font is embedded.
        textSize - Size of the text.
        lineSpacing - Additional spacing.
        See Also:
        FontStyle, EncodingType
      • FormattedText

        public FormattedText(String text,
                             Color textColor,
                             Color backColor,
                             String fontName,
                             int textEncoding,
                             boolean embedded,
                             float fontSize)

        Initializes FormattedText.

        Parameters:
        text - Text content.
        textColor - Color of the text.
        backColor - Color of background.
        fontName - Font of the text.
        textEncoding - Encoding of the text.
        embedded - If true font will be embedded.
        fontSize - Size of the text.
        See Also:
        EncodingType
      • FormattedText

        public FormattedText(String text,
                             Color textColor,
                             Color backColor)

        Initializes FormattedText.

        Parameters:
        text - Text content.
        textColor - Color of the text.
        backColor - Color of background.
      • FormattedText

        public FormattedText(String text,
                             Color textColor,
                             String fontName,
                             int textEncoding,
                             boolean embedded,
                             float fontSize)

        Initializes FormattedText.

        Parameters:
        text - Text content.
        textColor - Color of the text.
        fontName - Font of the text.
        textEncoding - Encoding of the text.
        embedded - If true font will be embedded.
        fontSize - Size of the text.
        See Also:
        EncodingType
    • Method Detail

      • getText

        public com.aspose.ms.System.Collections.Generic.List<String> getText()
        For Internal usage only
        Returns:
        Internal object
      • getMpCustomLineSpacing

        public com.aspose.ms.System.Collections.Generic.Dictionary<Integer,Float> getMpCustomLineSpacing()
        For Internal usage only
        Returns:
        Internal object
      • getFirstLine

        public String getFirstLine()

        Gets first line

        Returns:
        String value
      • getTextColor

        public com.aspose.ms.System.Drawing.Color getTextColor()

        Internal Gets text color

        Returns:
        Color element
      • getBackColor

        public com.aspose.ms.System.Drawing.Color getBackColor()

        Internal Gets back color

        Returns:
        Color element
      • getFont

        public Font getFont()

        Gets font

        Returns:
        Font element
      • getFontSize

        public float getFontSize()

        Gets font size

        Returns:
        float value
      • getTextHeight

        public float getTextHeight()

        Gets height of text.

        Returns:
        float value
      • getTextWidth

        public float getTextWidth()

        Gets width of text.

        Returns:
        float value
      • addNewLineText

        public void addNewLineText(String newLineText)

        Adds a new line to the FormattedText object and sets the newLineText to the next line's text.

        Parameters:
        newLineText - Text of new added line.
      • addNewLineText

        public void addNewLineText(String newLineText,
                                   float lineSpacing)

        Adds a new line to the FormattedText object and sets the newLineText to the next line's text.

        Parameters:
        newLineText - Text of new added line.
        lineSpacing - Spacing of the line.