Class for generate Planet barcode

package Default
inherited_from \Zend\Barcode\Object\Postnet

 Methods

Constructor

__construct(array|\Traversable $options = null
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::__construct()

Parameters

$options

array\Traversable

Checking of parameters after all settings

checkParams() : boolean
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::checkParams()

Returns

boolean

Complete drawing of the barcode

draw() : array
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::draw()

Returns

arrayTable of instructions

Retrieve background color of the image

getBackgroundColor() : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getBackgroundColor()

Returns

integer

Get height of the barcode bar

getBarHeight() : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getBarHeight()

Returns

integer

Get thickness of thick bar

getBarThickWidth() : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getBarThickWidth()

Returns

integer

Get thickness of thin bar

getBarThinWidth() : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getBarThinWidth()

Returns

integer

Retrieve barcode namespace

getBarcodeNamespace() : string
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getBarcodeNamespace()

Returns

string

Get barcode checksum

getChecksum(string $text) : integer
Inherited

Parameters

$text

string

Returns

integer

Retrieve if drawing of text to encode is enabled

getDrawText() : boolean
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getDrawText()

Returns

boolean

Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

getFactor() : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getFactor()

Returns

integer

Retrieve the font

getFont() : integer | string
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getFont()

Returns

integerstring

Retrieve the size of the font in case of TTF

getFontSize() : float
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getFontSize()

Returns

float

Retrieve color of the barcode and text

getForeColor() : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getForeColor()

Returns

integer

Get height of the result object

getHeight(boolean $recalculate = false) : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getHeight()

Parameters

$recalculate

boolean

Returns

integer

Retrieve the set of drawing instructions

getInstructions() : array
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getInstructions()

Returns

array

Calculate the offset from the left of the object if an orientation is activated

getOffsetLeft(boolean $recalculate = false) : float
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getOffsetLeft()

Parameters

$recalculate

boolean

Returns

float

Calculate the offset from the top of the object if an orientation is activated

getOffsetTop(boolean $recalculate = false) : float
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getOffsetTop()

Parameters

$recalculate

boolean

Returns

float

Retrieve orientation of barcode and text

getOrientation() : float
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getOrientation()

Returns

float

Quiet zone before first bar and after the last bar

getQuietZone() : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getQuietZone()

Returns

integer

Retrieve text to encode

getRawText() : string
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getRawText()

Returns

string

Retrieve if the adjustment of the position of the characters to the position of the bars is enabled

getStretchText() : boolean
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getStretchText()

Returns

boolean

Retrieve text to encode

getText() : string
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getText()

Returns

string

Retrieve text to display

getTextToDisplay() : string
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getTextToDisplay()

Returns

string

Retrieve type of barcode

getType() : string
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getType()

Returns

string

Get width of the result object

getWidth(boolean $recalculate = false) : integer
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getWidth()

Parameters

$recalculate

boolean

Returns

integer

Retrieve if border are draw or not

getWithBorder() : boolean
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getWithBorder()

Returns

boolean

Retrieve if the checksum character is automatically added to the barcode text

getWithChecksum() : boolean
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getWithChecksum()

Returns

boolean

Retrieve if the checksum character is automatically added to the barcode text

getWithChecksumInText() : boolean
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::getWithChecksumInText()

Returns

boolean

Retrieve if quiet zones are draw or not

getWithQuietZones() : boolean
Inherited

Returns

boolean

Set the color of the background

setBackgroundColor(integer $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setBackgroundColor()

Parameters

$value

integer

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set height of the barcode bar

setBarHeight(integer $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setBarHeight()

Parameters

$value

integer

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set thickness of thick bar

setBarThickWidth(integer $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setBarThickWidth()

Parameters

$value

integer

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set thickness of thin bar

setBarThinWidth(integer $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setBarThinWidth()

Parameters

$value

integer

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set barcode namespace for autoloading

setBarcodeNamespace(string $namespace) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setBarcodeNamespace()

Parameters

$namespace

string

Returns

\Zend\Barcode\Object\ObjectInterface

Activate/deactivate drawing of text to encode

setDrawText(boolean $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setDrawText()

Parameters

$value

boolean

Returns

\Zend\Barcode\Object\ObjectInterface

Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

setFactor(integer|float|string|boolean $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setFactor()

Parameters

$value

integerfloatstringboolean

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set the font: - if integer between 1 and 5, use gd built-in fonts - if string, $value is assumed to be the path to a TTF font

setFont(integer|string $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setFont()

Parameters

$value

integerstring

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set the size of the font in case of TTF

setFontSize(float $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setFontSize()

Parameters

$value

float

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set color of the barcode and text

setForeColor(string $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setForeColor()

Parameters

$value

string

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set barcode state from options array

setOptions(array $options) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setOptions()

Parameters

$options

array

Returns

\Zend\Barcode\Object\ObjectInterface

Set orientation of barcode and text

setOrientation(integer|float|string|boolean $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setOrientation()

Parameters

$value

integerfloatstringboolean

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Allow fast inversion of font/bars color and background color

setReverseColor() : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setReverseColor()

Returns

\Zend\Barcode\Object\ObjectInterface

Activate/deactivate the adjustment of the position of the characters to the position of the bars

setStretchText(boolean $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setStretchText()

Parameters

$value

boolean

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Set text to encode

setText(string $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setText()

Parameters

$value

string

Returns

\Zend\Barcode\Object\ObjectInterface

Activate/deactivate drawing of the bar

setWithBorder(boolean $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setWithBorder()

Parameters

$value

boolean

Returns

\Zend\Barcode\Object\ObjectInterface

Activate/deactivate the automatic generation of the checksum character added to the barcode text

setWithChecksum(boolean $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setWithChecksum()

Parameters

$value

boolean

Returns

\Zend\Barcode\Object\ObjectInterface

Activate/deactivate the automatic generation of the checksum character added to the barcode text

setWithChecksumInText(boolean $value) : \Zend\Barcode\Object\ObjectInterface
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::setWithChecksumInText()

Parameters

$value

boolean

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Returns

\Zend\Barcode\Object\ObjectInterface

Activate/deactivate drawing of the quiet zones

setWithQuietZones(boolean $value) : \Zend\Barcode\Object\AbstractObject
Inherited

Parameters

$value

boolean

Returns

\Zend\Barcode\Object\AbstractObject

Check for invalid characters

validateText(string $value) 
Inherited
inherited_from \Zend\Barcode\Object\ObjectInterface::validateText()

Parameters

$value

string

Text to be checked

Add an instruction in the array of instructions

addInstruction(array $instruction) 
Inherited

Parameters

$instruction

array

Automatically add leading zeros if barcode length is fixed

addLeadingZeros(string $text, boolean $withoutChecksum = false) : string
Inherited

Parameters

$text

string

$withoutChecksum

boolean

Returns

string

Add a polygon drawing instruction in the set of instructions

addPolygon(array $points, integer $color = null, boolean $filled = true
Inherited

Parameters

$points

array

$color

integer

$filled

boolean

Add a text drawing instruction in the set of instructions

addText(string $text, float $size, array<mixed,integer> $position, string $font, integer $color, string $alignment = 'center', float|integer $orientation = 0
Inherited

Parameters

$text

string

$size

float

$position

array<mixed,integer>

$font

string

$color

integer

$alignment

string

$orientation

floatinteger

Height of the barcode

calculateBarcodeHeight() : integer
Inherited

Returns

integer

Calculate the width of the barcode

calculateBarcodeWidth() : integer
Inherited

Returns

integer

Height of the result object

calculateHeight() : integer
Inherited

Returns

integer

Width of the result image (before any rotation)

calculateWidth() : integer
Inherited

Returns

integer

Drawing with an angle is just allow TTF font

checkFontAndOrientation() 
Inherited

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Check the ratio between the thick and the thin bar

checkRatio(integer $min = 2, integer $max = 3
Inherited

Parameters

$min

integer

$max

integer

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Checking of parameters after all settings

checkSpecificParams() 
Inherited

Check if a text is really provided to barcode

checkText(string|null $value = null
Inherited

Parameters

$value

stringnull

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Draw the barcode

drawBarcode() 
Inherited

Partial function to draw border

drawBorder() 
Inherited

Partial function to draw text

drawText() 
Inherited

Set default options for particular object

getDefaultOptions() 
Inherited

Allow each child to draw something else (ex: bearer bars in interleaved 2 of 5 code)

postDrawBarcode() 
Inherited

Allow each child to draw something else

preDrawBarcode() 
Inherited

Each child must prepare the barcode and return a table like array( 0 => array( 0 => int (visible(black) or not(white)) 1 => int (width of the bar) 2 => float (0->1 position from the top of the beginning of the bar in %) 3 => float (0->1 position from the top of the end of the bar in %) ), 1 => .

prepareBarcode() : array
Inherited

.. )

Returns

array

Apply rotation on a point in X/Y dimensions

rotate(float $x1, float $y1) : array
Inherited

Parameters

$x1

float

x-position before rotation

$y1

float

y-position before rotation

Returns

arrayArray of two elements corresponding to the new XY point

Standard validation for most of barcode objects

validateSpecificText(string $value, array $options = array()
Inherited

Parameters

$value

string

$options

array

 Properties

 

Activate automatic addition of leading zeros if barcode length is fixed

$addLeadingZeros : boolean

Default

true
 

Background color of the object

$backgroundColor : integer

Default

16777215
 

Height of the bar

$barHeight : integer

Default

50
 

Width of a thick bar

$barThickWidth : integer

Default

3
 

Width of a thin bar

$barThinWidth : integer

Default

1
 

Fix barcode length (numeric or string like 'even')

$barcodeLength : integer

Default

null
 

Namespace of the barcode for autoloading

$barcodeNamespace : string

Default

'Zend\Barcode\Object'
 

Coding map - 0 = half bar - 1 = complete bar

$codingMap : array

Default

array(0 => "00111", 1 => "11100", 2 => "11010", 3 => "11001", 4 => "10110", 5 => "10101", 6 => "10011", 7 => "01110", 8 => "01101", 9 => "01011")
inherited_from \Zend\Barcode\Object\Postnet::codingMap
 

Coding map - 0 = half bar - 1 = complete bar

$codingMap : array

Default

array(0 => "11000", 1 => "00011", 2 => "00101", 3 => "00110", 4 => "01001", 5 => "01010", 6 => "01100", 7 => "10001", 8 => "10010", 9 => "10100")
 

Display (or not) human readable text

$drawText : boolean

Default

true
 

Factor to multiply bar and font measure (barHeight, barThinWidth, barThickWidth & fontSize)

$factor : integer

Default

1
 

Font resource - integer (1 to 5): corresponds to GD included fonts - string: corresponds to path of a TTF font

$font : integer | string

Default

null
 

Font size

$fontSize : float

Default

10
 

Font and bars color of the object

$foreColor : integer

Default

0
 

Height of the object

$height : integer

Default

null
 

Set of drawing instructions

$instructions : array

Default

array()
 

Activation of mandatory checksum to deactivate unauthorized modification

$mandatoryChecksum : boolean

Default

false
 

Force quiet zones even if

$mandatoryQuietZones : boolean

Default

false
 

Offset from the left the object (calculated from the orientation)

$offsetLeft : integer

Default

null
 

Offset from the top the object (calculated from the orientation)

$offsetTop : integer

Default

null
 

Orientation of the barcode in degrees

$orientation : float

Default

0
 

Adjust (or not) position of human readable characters with barcode

$stretchText : boolean

Default

false
 

Character used to substitute checksum character for validation

$substituteChecksumCharacter : mixed

Default

0
 

Text to display

$text : string

Default

null
 

Barcode type

$type : string

Default

null
 

Width of the object

$width : integer

Default

null
 

Activate/deactivate border of the object

$withBorder : boolean

Default

false
 

Drawing of checksum

$withChecksum : boolean

Default

false
 

Drawing of checksum inside text

$withChecksumInText : boolean

Default

false
 

Activate/deactivate drawing of quiet zones

$withQuietZones : boolean

Default

true