Class Text

All Implemented Interfaces:
IAbstractElement, IElement, ILeafElement, IPropertyContainer, IAccessibleElement
Direct Known Subclasses:
Link

public class Text extends AbstractElement<Text> implements ILeafElement, IAccessibleElement
A Text is a piece of text of any length. As a leaf element, it is the smallest piece of content that may bear specific layout attributes.
  • Field Details

  • Constructor Details

    • Text

      public Text (String text)
      Constructs a Text with its role initialized.
      Parameters:
      text - the contents, as a String
  • Method Details

    • getText

      public String getText()
      Gets the contents of the Text object that will be rendered.
      Returns:
      the string with the contents
    • setText

      public void setText (String text)
      Sets the contents of the Text object.
      Parameters:
      text - the new contents
    • getTextRise

      public float getTextRise()
      Gets the text rise.
      Returns:
      the vertical distance from the text's default base line, as a float.
    • setTextRise

      public Text setTextRise (float textRise)
      Sets the text rise.
      Parameters:
      textRise - a vertical distance from the text's default base line.
      Returns:
      this Text
    • getHorizontalScaling

      public Float getHorizontalScaling()
      Gets the horizontal scaling property, which determines how wide the text should be stretched.
      Returns:
      the horizontal spacing, as a float
    • setSkew

      public Text setSkew (float alpha, float beta)
      Skews the text to simulate italic and other effects. Try alpha=0 and beta=12.
      Parameters:
      alpha - the first angle in degrees
      beta - the second angle in degrees
      Returns:
      this Text
    • setHorizontalScaling

      public Text setHorizontalScaling (float horizontalScaling)
      The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction.
      Parameters:
      horizontalScaling - the scaling parameter. 1 means no scaling will be applied, 0.5 means the text will be scaled by half. 2 means the text will be twice as wide as normal one.
      Returns:
      this Text
    • getAccessibilityProperties

      public AccessibilityProperties getAccessibilityProperties()
      Description copied from interface: IAccessibleElement
      Specified by:
      getAccessibilityProperties in interface IAccessibleElement
      Returns:
      an interface that allows to specify properties of a tagged element in Tagged PDF.
    • setNeutralRole

      public Text setNeutralRole()
      Give this element a neutral role. See also AccessibilityProperties.setRole(String).
      Returns:
      this Element
    • makeNewRenderer

      protected IRenderer makeNewRenderer()
      Description copied from class: AbstractElement
      Creates new renderer instance.
      Specified by:
      makeNewRenderer in class AbstractElement<Text>
      Returns:
      new IRenderer