Package net.atthegate.server.service.pdf
Class TextBlock
java.lang.Object
net.atthegate.server.service.pdf.TextBlock
Class for creating blocks of text.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDraws this text block on the specified page.int
Returns the background color.int
Returns the brush color.float
Returns the text block height.float
Returns the space between two lines of text.int
Returns the text alignment.float
getWidth()
Returns the text block width.setBgColor
(int color) Sets the background to the specified color.setBrushColor
(int color) Sets the brush color.setFallbackFont
(Font fallbackFont) Sets the fallback font.setHeight
(float height) Sets the height of this text block.setLocation
(float x, float y) Sets the location where this text block will be drawn on the page.setSpaceBetweenLines
(float space) Sets the space between two lines of text.Sets the block text.setTextAlignment
(int textAlign) Sets the text alignment.setWidth
(float width) Sets the width of this text block.
-
Constructor Details
-
TextBlock
Creates a text block.- Parameters:
font
- the text font.
-
-
Method Details
-
setFallbackFont
Sets the fallback font.- Parameters:
fallbackFont
- the fallback font.- Returns:
- the TextBlock object.
-
setText
Sets the block text.- Parameters:
text
- the block text.- Returns:
- the TextBlock object.
-
setLocation
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
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
Sets the height of this text block.- Parameters:
height
- the specified height.- Returns:
- the TextBlock object.
-
getHeight
Returns the text block height.- Returns:
- the text block height.
- Throws:
Exception
-
setSpaceBetweenLines
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
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
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
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
Draws this text block on the specified page.- Parameters:
page
- the page to draw this text block on.- Returns:
- the TextBlock object.
- Throws:
Exception
-