com.pdfjet
Class TextBlock

java.lang.Object
  extended by com.pdfjet.TextBlock

public class TextBlock
extends java.lang.Object

Class for creating blocks of text.


Constructor Summary
TextBlock(Font font)
          Creates a text block.
 
Method Summary
 TextBlock drawOn(Page page)
          Draws this text block on the specified page.
 int getBgColor()
          Returns the background color.
 int getBrushColor()
          Returns the brush color.
 float getHeight()
          Returns the text block height.
 float getSpaceBetweenLines()
          Returns the space between two lines of text.
 int getTextAlignment()
          Returns the text alignment.
 float getWidth()
          Returns the text block width.
 TextBlock setBgColor(int color)
          Sets the background to the specified color.
 TextBlock setBrushColor(int color)
          Sets the brush color.
 TextBlock setFallbackFont(Font fallbackFont)
          Sets the fallback font.
 TextBlock setHeight(float height)
          Sets the height of this text block.
 TextBlock setLocation(float x, float y)
          Sets the location where this text block will be drawn on the page.
 TextBlock setSpaceBetweenLines(float space)
          Sets the space between two lines of text.
 TextBlock setText(java.lang.String text)
          Sets the block text.
 TextBlock setTextAlignment(int textAlign)
          Sets the text alignment.
 TextBlock setWidth(float width)
          Sets the width of this text block.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextBlock

public TextBlock(Font font)
Creates a text block.

Parameters:
font - the text font.
Method Detail

setFallbackFont

public TextBlock setFallbackFont(Font fallbackFont)
Sets the fallback font.

Parameters:
fallbackFont - the fallback font.
Returns:
the TextBlock object.

setText

public TextBlock setText(java.lang.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 java.lang.Exception
Returns the text block height.

Returns:
the text block height.
Throws:
java.lang.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 java.lang.Exception
Draws this text block on the specified page.

Parameters:
page - the page to draw this text block on.
Returns:
the TextBlock object.
Throws:
java.lang.Exception