Constants

POSITION_TOP

POSITION_TOP = 0

POSITION_RIGHT

POSITION_RIGHT = 1

POSITION_BOTTOM

POSITION_BOTTOM = 2

POSITION_LEFT

POSITION_LEFT = 3

ALIGN_LEFT

ALIGN_LEFT = 0

ALIGN_TOP

ALIGN_TOP = 0

ALIGN_CENTER

ALIGN_CENTER = 1

ALIGN_RIGHT

ALIGN_RIGHT = 2

ALIGN_BOTTOM

ALIGN_BOTTOM = 2

Properties

$font

$font : 

Type

$text

$text : 

Type

$position

$position : 

Type

$alignment

$alignment : 

Type

$offset

$offset : 

Type

$spacing

$spacing : 

Type

$rotationAngle

$rotationAngle : 

Type

$backgroundColor

$backgroundColor : 

Type

$foregroundColor

$foregroundColor : 

Type

Methods

__construct()

__construct(string  $text = '', \BCGFont  $font = null, integer  $position = self::POSITION_BOTTOM, integer  $alignment = self::ALIGN_CENTER) 

Constructor.

Parameters

string $text
\BCGFont $font
integer $position
integer $alignment

getText()

getText() : string

Gets the text.

Returns

string

setText()

setText(string  $text) 

Sets the text.

Parameters

string $text

getFont()

getFont() : \BCGFont

Gets the font.

Returns

\BCGFont

setFont()

setFont(\BCGFont  $font) 

Sets the font.

Parameters

\BCGFont $font

getPosition()

getPosition() : integer

Gets the text position for drawing.

Returns

integer

setPosition()

setPosition(integer  $position) 

Sets the text position for drawing.

Parameters

integer $position

getAlignment()

getAlignment() : integer

Gets the text alignment for drawing.

Returns

integer

setAlignment()

setAlignment(integer  $alignment) 

Sets the text alignment for drawing.

Parameters

integer $alignment

getOffset()

getOffset() : integer

Gets the offset.

Returns

integer

setOffset()

setOffset(integer  $offset) 

Sets the offset.

Parameters

integer $offset

getSpacing()

getSpacing() : integer

Gets the spacing.

Returns

integer

setSpacing()

setSpacing(integer  $spacing) 

Sets the spacing.

Parameters

integer $spacing

getRotationAngle()

getRotationAngle() : integer

Gets the rotation angle in degree.

Returns

integer

setRotationAngle()

setRotationAngle(integer  $rotationAngle) 

Sets the rotation angle in degree.

Parameters

integer $rotationAngle

getBackgroundColor()

getBackgroundColor() : \BCGColor

Gets the background color in case of rotation.

Returns

\BCGColor

setBackgroundColor()

setBackgroundColor(\BCGColor  $backgroundColor) 

Sets the background color in case of rotation.

Parameters

\BCGColor $backgroundColor

getForegroundColor()

getForegroundColor() : \BCGColor

Gets the foreground color.

Returns

\BCGColor

setForegroundColor()

setForegroundColor(\BCGColor  $foregroundColor) 

Sets the foreground color.

Parameters

\BCGColor $foregroundColor

getDimension()

getDimension() : array<mixed,integer>

Gets the dimension taken by the label, including the spacing and offset.

Returns

array<mixed,integer>

draw()

draw(resource  $im, integer  $x1, integer  $y1, integer  $x2, integer  $y2) 

Draws the text.

The coordinate passed are the positions of the barcode. $x1 and $y1 represent the top left corner. $x2 and $y2 represent the bottom right corner.

Parameters

resource $im
integer $x1
integer $y1
integer $x2
integer $y2