Class TextBlock

java.lang.Object
net.atthegate.server.service.pdf.TextBlock

public class TextBlock extends Object
Class for creating blocks of text.
  • Constructor Details

    • TextBlock

      public TextBlock(Font font)
      Creates a text block.
      Parameters:
      font - the text font.
  • Method Details

    • setFallbackFont

      public TextBlock setFallbackFont(Font fallbackFont)
      Sets the fallback font.
      Parameters:
      fallbackFont - the fallback font.
      Returns:
      the TextBlock object.
    • setText

      public TextBlock setText(String text)
      Sets the block text.
      Parameters:
      text - the block text.
      Returns:
      the TextBlock object.
    • setLocation

      public TextBlock setLocation(float x, float y)
      Sets the location where this text block will be drawn on the page.
      Parameters:
      x - the x coordinate of the top left corner of the text block.
      y - the y coordinate of the top left corner of the text block.
      Returns:
      the TextBlock object.
    • setWidth

      public TextBlock setWidth(float width)
      Sets the width of this text block.
      Parameters:
      width - the specified width.
      Returns:
      the TextBlock object.
    • getWidth

      public float getWidth()
      Returns the text block width.
      Returns:
      the text block width.
    • setHeight

      public TextBlock setHeight(float height)
      Sets the height of this text block.
      Parameters:
      height - the specified height.
      Returns:
      the TextBlock object.
    • getHeight

      public float getHeight() throws Exception
      Returns the text block height.
      Returns:
      the text block height.
      Throws:
      Exception
    • setSpaceBetweenLines

      public TextBlock setSpaceBetweenLines(float space)
      Sets the space between two lines of text.
      Parameters:
      space - the space between two lines.
      Returns:
      the TextBlock object.
    • getSpaceBetweenLines

      public float getSpaceBetweenLines()
      Returns the space between two lines of text.
      Returns:
      float the space.
    • setTextAlignment

      public TextBlock setTextAlignment(int textAlign)
      Sets the text alignment.
      Parameters:
      textAlign - the alignment parameter. Supported values: Align.LEFT, Align.RIGHT and Align.CENTER.
    • getTextAlignment

      public int getTextAlignment()
      Returns the text alignment.
      Returns:
      the alignment code.
    • setBgColor

      public TextBlock setBgColor(int color)
      Sets the background to the specified color.
      Parameters:
      color - the color specified as 0xRRGGBB integer.
      Returns:
      the TextBlock object.
    • getBgColor

      public int getBgColor()
      Returns the background color.
      Returns:
      int the color as 0xRRGGBB integer.
    • setBrushColor

      public TextBlock setBrushColor(int color)
      Sets the brush color.
      Parameters:
      color - the color specified as 0xRRGGBB integer.
      Returns:
      the TextBlock object.
    • getBrushColor

      public int getBrushColor()
      Returns the brush color.
      Returns:
      int the brush color specified as 0xRRGGBB integer.
    • drawOn

      public TextBlock drawOn(Page page) throws Exception
      Draws this text block on the specified page.
      Parameters:
      page - the page to draw this text block on.
      Returns:
      the TextBlock object.
      Throws:
      Exception