Class TextLine

java.lang.Object
net.atthegate.server.service.pdf.TextLine
All Implemented Interfaces:
Drawable

public class TextLine extends Object implements Drawable
Used to create text line objects.
  • Field Details

    • x

      protected float x
    • y

      protected float y
    • font

      protected Font font
    • fallbackFont

      protected Font fallbackFont
    • str

      protected String str
    • trailingSpace

      protected boolean trailingSpace
  • Constructor Details

    • TextLine

      public TextLine(Font font)
      Constructor for creating text line objects.
      Parameters:
      font - the font to use.
    • TextLine

      public TextLine(Font font, String text)
      Constructor for creating text line objects.
      Parameters:
      font - the font to use.
      text - the text.
  • Method Details

    • setText

      public TextLine setText(String text)
      Sets the text.
      Parameters:
      text - the text.
      Returns:
      this TextLine.
    • getText

      public String getText()
      Returns the text.
      Returns:
      the text.
    • setPosition

      public TextLine setPosition(double x, double y)
      Sets the position where this text line will be drawn on the page.
      Parameters:
      x - the x coordinate of the text line.
      y - the y coordinate of the text line.
      Returns:
      this TextLine.
    • setPosition

      public TextLine setPosition(float x, float y)
      Sets the position where this text line will be drawn on the page.
      Parameters:
      x - the x coordinate of the text line.
      y - the y coordinate of the text line.
      Returns:
      this TextLine.
    • setLocation

      public TextLine setLocation(float x, float y)
      Sets the location where this text line will be drawn on the page.
      Parameters:
      x - the x coordinate of the text line.
      y - the y coordinate of the text line.
      Returns:
      this TextLine.
    • setFont

      public TextLine setFont(Font font)
      Sets the font to use for this text line.
      Parameters:
      font - the font to use.
      Returns:
      this TextLine.
    • getFont

      public Font getFont()
      Gets the font to use for this text line.
      Returns:
      font the font to use.
    • setFontSize

      public TextLine setFontSize(float fontSize)
      Sets the font size to use for this text line.
      Parameters:
      fontSize - the fontSize to use.
      Returns:
      this TextLine.
    • setFallbackFont

      public TextLine setFallbackFont(Font fallbackFont)
      Sets the fallback font.
      Parameters:
      fallbackFont - the fallback font.
      Returns:
      this TextLine.
    • setFallbackFontSize

      public TextLine setFallbackFontSize(float fallbackFontSize)
      Sets the fallback font size to use for this text line.
      Parameters:
      fallbackFontSize - the fallback font size.
      Returns:
      this TextLine.
    • getFallbackFont

      public Font getFallbackFont()
      Returns the fallback font.
      Returns:
      the fallback font.
    • setColor

      public TextLine setColor(int color)
      Sets the color for this text line.
      Parameters:
      color - the color is specified as an integer.
      Returns:
      this TextLine.
    • setColor

      public TextLine setColor(int[] color)
      Sets the pen color.
      Parameters:
      color - the color. See the Color class for predefined values or define your own using 0x00RRGGBB packed integers.
      Returns:
      this TextLine.
    • getColor

      public int getColor()
      Returns the text line color.
      Returns:
      the text line color.
    • getDestinationY

      public float getDestinationY()
      Returns the y coordinate of the destination.
      Returns:
      the y coordinate of the destination.
    • getY

      public float getY()
      Returns the y coordinate of the destination.
      Returns:
      the y coordinate of the destination.
    • getWidth

      public float getWidth()
      Returns the width of this TextLine.
      Returns:
      the width.
    • getHeight

      public float getHeight()
      Returns the height of this TextLine.
      Returns:
      the height.
    • setURIAction

      public TextLine setURIAction(String uri)
      Sets the URI for the "click text line" action.
      Parameters:
      uri - the URI
      Returns:
      this TextLine.
    • getURIAction

      public String getURIAction()
      Returns the action URI.
      Returns:
      the action URI.
    • setGoToAction

      public TextLine setGoToAction(String key)
      Sets the destination key for the action.
      Parameters:
      key - the destination name.
      Returns:
      this TextLine.
    • getGoToAction

      public String getGoToAction()
      Returns the GoTo action string.
      Returns:
      the GoTo action string.
    • setUnderline

      public TextLine setUnderline(boolean underline)
      Sets the underline variable. If the value of the underline variable is 'true' - the text is underlined.
      Parameters:
      underline - the underline flag.
      Returns:
      this TextLine.
    • getUnderline

      public boolean getUnderline()
      Returns the underline flag.
      Returns:
      the underline flag.
    • setStrikeout

      public TextLine setStrikeout(boolean strikeout)
      Sets the strike variable. If the value of the strike variable is 'true' - a strike line is drawn through the text.
      Parameters:
      strikeout - the strikeout flag.
      Returns:
      this TextLine.
    • getStrikeout

      public boolean getStrikeout()
      Returns the strikeout flag.
      Returns:
      the strikeout flag.
    • setTextDirection

      public TextLine setTextDirection(int degrees)
      Sets the direction in which to draw the text.
      Parameters:
      degrees - the number of degrees.
      Returns:
      this TextLine.
    • getTextDirection

      public int getTextDirection()
      Returns the text direction.
      Returns:
      the text direction.
    • setTextEffect

      public TextLine setTextEffect(int textEffect)
      Sets the text effect.
      Parameters:
      textEffect - Effect.NORMAL, Effect.SUBSCRIPT or Effect.SUPERSCRIPT.
      Returns:
      this TextLine.
    • getTextEffect

      public int getTextEffect()
      Returns the text effect.
      Returns:
      the text effect.
    • setVerticalOffset

      public TextLine setVerticalOffset(float verticalOffset)
      Sets the vertical offset of the text.
      Parameters:
      verticalOffset - the vertical offset.
      Returns:
      this TextLine.
    • getVerticalOffset

      public float getVerticalOffset()
      Returns the vertical text offset.
      Returns:
      the vertical text offset.
    • setTrailingSpace

      public TextLine setTrailingSpace(boolean trailingSpace)
      Sets the trailing space after this text line when used in paragraph.
      Parameters:
      trailingSpace - the trailing space.
      Returns:
      this TextLine.
    • getTrailingSpace

      public boolean getTrailingSpace()
      Returns the trailing space.
      Returns:
      the trailing space.
    • setLanguage

      public TextLine setLanguage(String language)
    • getLanguage

      public String getLanguage()
    • setAltDescription

      public TextLine setAltDescription(String altDescription)
      Sets the alternate description of this text line.
      Parameters:
      altDescription - the alternate description of the text line.
      Returns:
      this TextLine.
    • getAltDescription

      public String getAltDescription()
    • setActualText

      public TextLine setActualText(String actualText)
      Sets the actual text for this text line.
      Parameters:
      actualText - the actual text for the text line.
      Returns:
      this TextLine.
    • getActualText

      public String getActualText()
    • setURILanguage

      public TextLine setURILanguage(String uriLanguage)
    • setURIAltDescription

      public TextLine setURIAltDescription(String uriAltDescription)
    • setURIActualText

      public TextLine setURIActualText(String uriActualText)
    • placeIn

      public TextLine placeIn(Box box) throws Exception
      Places this text line in the specified box.
      Parameters:
      box - the specified box.
      Returns:
      this TextLine.
      Throws:
      Exception
    • placeIn

      public TextLine placeIn(Box box, double x_offset, double y_offset) throws Exception
      Places this text line in the box at the specified offset.
      Parameters:
      box - the specified box.
      x_offset - the x offset from the top left corner of the box.
      y_offset - the y offset from the top left corner of the box.
      Returns:
      this TextLine.
      Throws:
      Exception
    • placeIn

      public TextLine placeIn(Box box, float x_offset, float y_offset) throws Exception
      Places this text line in the box at the specified offset.
      Parameters:
      box - the specified box.
      x_offset - the x offset from the top left corner of the box.
      y_offset - the y offset from the top left corner of the box.
      Returns:
      this TextLine.
      Throws:
      Exception
    • drawOn

      public float[] drawOn(Page page) throws Exception
      Draws this text line on the specified page.
      Specified by:
      drawOn in interface Drawable
      Parameters:
      page - the page to draw this text line on.
      Returns:
      x and y coordinates of the bottom right corner of this component.
      Throws:
      Exception
    • drawOn

      protected float[] drawOn(Page page, boolean draw) throws Exception
      Draws this text line on the specified page if the draw parameter is true.
      Parameters:
      page - the page to draw this text line on.
      draw - if draw is false - no action is performed.
      Throws:
      Exception