Class Text

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

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.
      text - the contents, as a String
  • Method Details

    • getText

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

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

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

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

      public Float getHorizontalScaling()
      Gets the horizontal scaling property, which determines how wide the text should be stretched.
      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.
      alpha - the first angle in degrees
      beta - the second angle in degrees
      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.
      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.
      this Text
    • getAccessibilityProperties

      public AccessibilityProperties getAccessibilityProperties()
      Description copied from interface: IAccessibleElement
      Specified by:
      getAccessibilityProperties in interface IAccessibleElement
      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).
      this Element
    • makeNewRenderer

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