Class TextElement

java.lang.Object
com.dynamicpdf.api.elements.Element
com.dynamicpdf.api.elements.TextElement

public class TextElement extends Element
Represents a text element.

This class can be used to place text on a page.

  • Constructor Details

    • TextElement

      public TextElement(String value, ElementPlacement placement, float xOffset, float yOffset)
      Initializes a new instance of the TextElement class
      Parameters:
      value - Text to display in the text element.
      placement - The placement of the text element on the page.
      xOffset - X coordinate of the text element.
      yOffset - Y coordinate of the text element.
    • TextElement

      public TextElement(String value, ElementPlacement placement)
      Initializes a new instance of the TextElement class
      Parameters:
      value - Text to display in the text element.
      placement - The placement of the text element on the page.
  • Method Details

    • getResource

      public Resource getResource()
      Overrides:
      getResource in class Element
    • getTextFont

      public Font getTextFont()
      Overrides:
      getTextFont in class Element
    • getText

      public String getText()
      Gets the text to display in the text element.
      Returns:
      The text to display in the text element.
    • setText

      public void setText(String value)
      Sets the text to display in the text element.
      Parameters:
      value - The text to display in the text element.
    • getColor

      public Color getColor()
      Gets the Color object to use for the text of the text element.
      Returns:
      The Color object to use for the text of the text element.
    • setColor

      public void setColor(Color value)
      Sets the Color object to use for the text of the text element.
      Parameters:
      value - The Color object to use for the text of the text element.
    • getFont

      public Font getFont()
      Gets the Font object used to specify the font of the text for the text element.
      Returns:
      The Font object used to specify the font of the text for the text element.
    • setFont

      public void setFont(Font value)
      Sets the Font object used to specify the font of the text for the text element.
      Parameters:
      value - The Font object used to specify the font of the text for the text element.
    • getFontSize

      public float getFontSize()
      Gets the font size for the text of the text element.
      Returns:
      The font size for the text of the text element.
    • setFontSize

      public void setFontSize(float value)
      Sets the font size for the text of the text element.
      Parameters:
      value - The font size for the text of the text element.