Class for generate Barcode

category Zend
package Zend_Barcode

 Methods

Constructor

__construct(array | \Traversable $options) 

Parameters

$options

array\Traversable

Checking of parameters after all settings

checkParams() : bool

Returns

bool

Complete drawing of the barcode

draw() : array

Returns

arrayTable of instructions

Retrieve background color of the image

getBackgroundColor() : integer

Returns

integer

Get height of the barcode bar

getBarHeight() : integer

Returns

integer

Get thickness of thick bar

getBarThickWidth() : integer

Returns

integer

Get thickness of thin bar

getBarThinWidth() : integer

Returns

integer

Retrieve barcode namespace

getBarcodeNamespace() : string

Returns

string

Retrieve if drawing of text to encode is enabled

getDrawText() : bool

Returns

bool

Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

getFactor() : integer

Returns

integer

Retrieve the font

getFont() : integer | string

Returns

integerstring

Retrieve the size of the font in case of TTF

getFontSize() : float

Returns

float

Retrieve color of the barcode and text

getForeColor() : integer

Returns

integer

Get height of the result object

getHeight(bool $recalculate) : integer

Parameters

$recalculate

bool

Returns

integer

Retrieve the set of drawing instructions

getInstructions() : array

Returns

array

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

getOffsetLeft(bool $recalculate) : float

Parameters

$recalculate

bool

Returns

float

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

getOffsetTop(bool $recalculate) : float

Parameters

$recalculate

bool

Returns

float

Retrieve orientation of barcode and text

getOrientation() : float

Returns

float

Quiet zone before first bar and after the last bar

getQuietZone() : integer

Returns

integer

Retrieve text to encode

getRawText() : string

Returns

string

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

getStretchText() : bool

Returns

bool

Retrieve text to encode

getText() : string

Returns

string

Retrieve text to display

getTextToDisplay() : string

Returns

string

Retrieve type of barcode

getType() : string

Returns

string

Get width of the result object

getWidth(bool $recalculate) : integer

Parameters

$recalculate

bool

Returns

integer

Retrieve if border are draw or not

getWithBorder() : bool

Returns

bool

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

getWithChecksum() : bool

Returns

bool

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

getWithChecksumInText() : bool

Returns

bool

Retrieve if quiet zones are draw or not

getWithQuietZones() : bool

Returns

bool

Set the color of the background

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

Set height of the barcode bar

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

Set thickness of thick bar

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

Set thickness of thin bar

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

Set barcode namespace for autoloading

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

Parameters

$namespace

string

Returns

Activate/deactivate drawing of text to encode

setDrawText(bool $value) : \Zend\Barcode\Object\ObjectInterface

Parameters

$value

bool

Returns

Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

setFactor(float $value) : \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

Set the size of the font in case of TTF

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

Set color of the barcode and text

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

Set barcode state from options array

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

Parameters

$options

array

Returns

Set orientation of barcode and text

setOrientation(float $value) : \Zend\Barcode\Object\ObjectInterface

Allow fast inversion of font/bars color and background color

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

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

setStretchText(bool $value) : \Zend\Barcode\Object\ObjectInterface

Set text to encode

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

Parameters

$value

string

Returns

Activate/deactivate drawing of the bar

setWithBorder(bool $value) : \Zend\Barcode\Object\ObjectInterface

Parameters

$value

bool

Returns

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

setWithChecksum(bool $value) : \Zend\Barcode\Object\ObjectInterface

Parameters

$value

bool

Returns

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

setWithChecksumInText(bool $value) : \Zend\Barcode\Object\ObjectInterface

Activate/deactivate drawing of the quiet zones

setWithQuietZones(bool $value) : \Zend\Barcode\Object\AbstractObject

Parameters

$value

bool

Returns

Check for invalid characters

validateText(string $value) : void

Parameters

$value

string

Text to be checked

Add an instruction in the array of instructions

addInstruction(array $instruction) 

Parameters

$instruction

array

Automatically add leading zeros if barcode length is fixed

addLeadingZeros(string $text, bool $withoutChecksum) : string

Parameters

$text

string

$withoutChecksum

bool

Returns

string

Add a polygon drawing instruction in the set of instructions

addPolygon(array $points, integer $color, bool $filled) 

Parameters

$points

array

$color

integer

$filled

bool

Add a text drawing instruction in the set of instructions

addText(string $text, float $size, array $position, string $font, integer $color, string $alignment, float $orientation) 

Parameters

$text

string

$size

float

$position

array

$font

string

$color

integer

$alignment

string

$orientation

float

Height of the barcode

calculateBarcodeHeight() : integer

Returns

integer

Calculate the width of the barcode

calculateBarcodeWidth() : integer

Returns

integer

Height of the result object

calculateHeight() : integer

Returns

integer

Width of the result image (before any rotation)

calculateWidth() : integer

Returns

integer

Drawing with an angle is just allow TTF font

checkFontAndOrientation() : void

Check the ratio between the thick and the thin bar

checkRatio(integer $min, integer $max) : void

Parameters

$min

integer

$max

integer

Exceptions

\Zend\Barcode\Object\Exception\ExceptionInterface

Checking of parameters after all settings

checkSpecificParams() : void

Check if a text is really provided to barcode

checkText($value) : void

Draw the barcode

drawBarcode() : void

Partial function to draw border

drawBorder() : void

Partial function to draw text

drawText() : void

Set default options for particular object

getDefaultOptions() : void

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

postDrawBarcode() : void

Allow each child to draw something else

preDrawBarcode() : void

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

.. )

Returns

array

Apply rotation on a point in X/Y dimensions

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

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) 

Parameters

$value

string

$options

array

 Properties

 

Activate automatic addition of leading zeros if barcode length is fixed

$addLeadingZeros : bool

 

Background color of the object

$backgroundColor : integer

 

Height of the bar

$barHeight : integer

 

Width of a thick bar

$barThickWidth : integer

 

Width of a thin bar

$barThinWidth : integer

 

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

$barcodeLength : integer

 

Namespace of the barcode for autoloading

$barcodeNamespace : string

 

Display (or not) human readable text

$drawText : bool

 

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

$factor : integer

 

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

$font : integer | string

 

Font size

$fontSize : float

 

Font and bars color of the object

$foreColor : integer

 

Height of the object

$height : integer

 

Set of drawing instructions

$instructions : array

 

Activation of mandatory checksum to deactivate unauthorized modification

$mandatoryChecksum : bool

 

Force quiet zones even if

$mandatoryQuietZones : bool

 

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

$offsetLeft : integer

 

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

$offsetTop : integer

 

Orientation of the barcode in degrees

$orientation : float

 

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

$stretchText : bool

 

Character used to substitute checksum character for validation

$substituteChecksumCharacter : mixed

 

Text to display

$text : string

 

Barcode type

$type : string

 

Width of the object

$width : integer

 

Activate/deactivate border of the object

$withBorder : bool

 

Drawing of checksum

$withChecksum : bool

 

Drawing of checksum inside text

$withChecksumInText : bool

 

Activate/deactivate drawing of quiet zones

$withQuietZones : bool