Class for generate Code128 barcode

category Zend
package Zend_Barcode
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Barcode_Object_ObjectAbstract

 Methods

Constructor

__construct(array|\Zend_Config $options = null
Inherited

Parameters

$options

array\Zend_Config

Checking of parameters after all settings

checkParams() : boolean
Inherited

Returns

boolean

Complete drawing of the barcode

draw() : array
Inherited

Returns

arrayTable of instructions

Retrieve background color of the image

getBackgroundColor() : integer
Inherited

Returns

integer

Get height of the barcode bar

getBarHeight() : integer
Inherited

Returns

integer

Get thickness of thick bar

getBarThickWidth() : integer
Inherited

Returns

integer

Get thickness of thin bar

getBarThinWidth() : integer
Inherited

Returns

integer

Retrieve barcode namespace

getBarcodeNamespace() : string
Inherited

Returns

string

Get barcode checksum

getChecksum(string $text) : integer

Parameters

$text

string

Returns

integer

Retrieve if drawing of text to encode is enabled

getDrawText() : boolean
Inherited

Returns

boolean

Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

getFactor() : integer
Inherited

Returns

integer

Retrieve the font

getFont() : integer | string
Inherited

Returns

integerstring

Retrieve the size of the font in case of TTF

getFontSize() : float
Inherited

Returns

float

Retrieve color of the barcode and text

getForeColor() : \unknown
Inherited

Returns

\unknown

Get height of the result object

getHeight(boolean $recalculate = false) : integer
Inherited

Parameters

$recalculate

boolean

Returns

integer

Retrieve the set of drawing instructions

getInstructions() : array
Inherited

Returns

array

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

getOffsetLeft(boolean $recalculate = false) : float
Inherited

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

Parameters

$recalculate

boolean

Returns

float

Retrieve orientation of barcode and text

getOrientation() : float
Inherited

Returns

float

Quiet zone before first bar and after the last bar

getQuietZone() : integer
Inherited

Returns

integer

Retrieve text to encode

getRawText() : string
Inherited

Returns

string

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

getStretchText() : boolean
Inherited

Returns

boolean

Retrieve text to encode

getText() : string
inherited_from \Zend_Barcode_Object_ObjectAbstract::getText()

Returns

string

Retrieve text to encode

getText() : string
Inherited

Returns

string

Retrieve text to display

getTextToDisplay() : string
Inherited

Returns

string

Retrieve type of barcode

getType() : string
Inherited

Returns

string

Get width of the result object

getWidth(boolean $recalculate = false) : integer
Inherited

Parameters

$recalculate

boolean

Returns

integer

Retrieve if border are draw or not

getWithBorder() : boolean
Inherited

Returns

boolean

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

getWithChecksum() : boolean
Inherited

Returns

boolean

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

getWithChecksumInText() : boolean
Inherited

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_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

integer

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Set height of the barcode bar

setBarHeight(integer $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

integer

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Set thickness of thick bar

setBarThickWidth(integer $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

integer

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Set thickness of thin bar

setBarThinWidth(integer $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

integer

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Set the font for all instances of barcode

setBarcodeFont(string $font) 
InheritedStatic

Parameters

$font

string

Set barcode namespace for autoloading

setBarcodeNamespace(string $namespace) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$namespace

string

Returns

\Zend_Barcode_Object_Code128

Set barcode state from config object

setConfig(\Zend_Config $config) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$config

\Zend_Config

Returns

\Zend_Barcode_Object_Code128

Activate/deactivate drawing of text to encode

setDrawText(boolean $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

boolean

Returns

\Zend_Barcode_Object_Code128

Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

setFactor(integer|float|string|boolean $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

integerfloatstringboolean

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

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_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

integerstring

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Set the size of the font in case of TTF

setFontSize(float $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

float

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Set color of the barcode and text

setForeColor(string $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

string

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Set barcode state from options array

setOptions(array $options) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$options

array

Returns

\Zend_Barcode_Object_Code128

Set orientation of barcode and text

setOrientation(integer|float|string|boolean $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

integerfloatstringboolean

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Allow fast inversion of font/bars color and background color

setReverseColor() : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Returns

\Zend_Barcode_Object_Code128

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

setStretchText(boolean $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

boolean

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Set text to encode

setText(string $value) : \Zend_Barcode_Object
inherited_from \Zend_Barcode_Object_ObjectAbstract::setText()

Parameters

$value

string

Returns

\Zend_Barcode_Object

Set text to encode

setText(string $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

string

Returns

\Zend_Barcode_Object_Code128

Activate/deactivate drawing of the bar

setWithBorder(boolean $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

boolean

Returns

\Zend_Barcode_Object_Code128

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

setWithChecksum(boolean $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

boolean

Returns

\Zend_Barcode_Object_Code128

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

setWithChecksumInText(boolean $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

boolean

Exceptions

\Zend_Barcode_Object_Exception

Returns

\Zend_Barcode_Object_Code128

Activate/deactivate drawing of the quiet zones

setWithQuietZones(boolean $value) : \Zend_Barcode_Object_Code128
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

boolean

Returns

\Zend_Barcode_Object_Code128

Check for invalid characters

validateText(string $value) 
Inherited

Parameters

$value

string

Text to be ckecked

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 $position, string $font, integer $color, string $alignment = 'center', float|integer $orientation = 0
Inherited

Parameters

$text

string

$size

float

$position

array

$font

string

$color

integer

$alignment

string

$orientation

floatinteger

Height of the barcode

_calculateBarcodeHeight() : integer
Inherited

Returns

integer

Width of the barcode (in pixels)

_calculateBarcodeWidth() : integer
inherited_from \Zend_Barcode_Object_ObjectAbstract::_calculateBarcodeWidth()

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

Partial check of code128 barcode

_checkParams() : void
inherited_from \Zend_Barcode_Object_ObjectAbstract::_checkParams()

Checking of parameters after all settings

_checkParams() 
Inherited

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

Check if a text is really provided to barcode

_checkText(string|null $value = null
Inherited

Parameters

$value

stringnull

Exceptions

\Zend_Barcode_Object_Exception

Convert string to barcode string

_convertToBarcodeChars($string) : array

Parameters

$string

Returns

array

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

Checks if the next $length chars of $string starting at $pos are numeric.

_isDigit(string $string, integer $pos, integer $length = 2) : boolean
Static

Returns false if the end of the string is reached.

Parameters

$string

string

String to search

$pos

integer

Starting position

$length

integer

Length to search

Returns

boolean

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

Prepare array to draw barcode

_prepareBarcode() : array

.. )

inherited_from \Zend_Barcode_Object_ObjectAbstract::_prepareBarcode()

Returns

array

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

_validateText(string $value, array $options = array()) : boolean
inherited_from \Zend_Barcode_Object_ObjectAbstract::_validateText()

Parameters

$value

string

$options

array

Returns

boolean

Standard validation for most of barcode objects

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

Parameters

$value

string

$options

array

Exceptions

\Zend_Barcode_Object_Exception

 Properties

 

Activate automatic addition of leading zeros if barcode length is fixed

$_addLeadingZeros : 

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 : 

Default

null
 

Namespace of the barcode for autoloading

$_barcodeNamespace : string

Default

'Zend_Barcode_Object'
 

Character sets ABC

$_charSets : array

Default

array('A' => array(' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 'FNC3', 'FNC2', 'SHIFT', 'Code C', 'Code B', 'FNC4', 'FNC1', 'START A', 'START B', 'START C', 'STOP'), 'B' => array(' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 127, 'FNC3', 'FNC2', 'SHIFT', 'Code C', 'FNC4', 'Code A', 'FNC1', 'START A', 'START B', 'START C', 'STOP'), 'C' => array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', 'Code B', 'Code A', 'FNC1', 'START A', 'START B', 'START C', 'STOP'))
 

$_codingMap

$_codingMap 

Default

array(0 => "11011001100", 1 => "11001101100", 2 => "11001100110", 3 => "10010011000", 4 => "10010001100", 5 => "10001001100", 6 => "10011001000", 7 => "10011000100", 8 => "10001100100", 9 => "11001001000", 10 => "11001000100", 11 => "11000100100", 12 => "10110011100", 13 => "10011011100", 14 => "10011001110", 15 => "10111001100", 16 => "10011101100", 17 => "10011100110", 18 => "11001110010", 19 => "11001011100", 20 => "11001001110", 21 => "11011100100", 22 => "11001110100", 23 => "11101101110", 24 => "11101001100", 25 => "11100101100", 26 => "11100100110", 27 => "11101100100", 28 => "11100110100", 29 => "11100110010", 30 => "11011011000", 31 => "11011000110", 32 => "11000110110", 33 => "10100011000", 34 => "10001011000", 35 => "10001000110", 36 => "10110001000", 37 => "10001101000", 38 => "10001100010", 39 => "11010001000", 40 => "11000101000", 41 => "11000100010", 42 => "10110111000", 43 => "10110001110", 44 => "10001101110", 45 => "10111011000", 46 => "10111000110", 47 => "10001110110", 48 => "11101110110", 49 => "11010001110", 50 => "11000101110", 51 => "11011101000", 52 => "11011100010", 53 => "11011101110", 54 => "11101011000", 55 => "11101000110", 56 => "11100010110", 57 => "11101101000", 58 => "11101100010", 59 => "11100011010", 60 => "11101111010", 61 => "11001000010", 62 => "11110001010", 63 => "10100110000", 64 => "10100001100", 65 => "10010110000", 66 => "10010000110", 67 => "10000101100", 68 => "10000100110", 69 => "10110010000", 70 => "10110000100", 71 => "10011010000", 72 => "10011000010", 73 => "10000110100", 74 => "10000110010", 75 => "11000010010", 76 => "11001010000", 77 => "11110111010", 78 => "11000010100", 79 => "10001111010", 80 => "10100111100", 81 => "10010111100", 82 => "10010011110", 83 => "10111100100", 84 => "10011110100", 85 => "10011110010", 86 => "11110100100", 87 => "11110010100", 88 => "11110010010", 89 => "11011011110", 90 => "11011110110", 91 => "11110110110", 92 => "10101111000", 93 => "10100011110", 94 => "10001011110", 95 => "10111101000", 96 => "10111100010", 97 => "11110101000", 98 => "11110100010", 99 => "10111011110", 100 => "10111101110", 101 => "11101011110", 102 => "11110101110", 103 => "11010000100", 104 => "11010010000", 105 => "11010011100", 106 => "1100011101011")
 

$_convertedText

$_convertedText : array

Default

array()
 

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 : 

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
 

TTF font name: can be set before instanciation of the object

$_staticFont : string

Default

null
Static
 

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

$_stretchText : boolean

Default

false
 

Character used to substitute checksum character for validation

$_substituteChecksumCharacter : 

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 (even if it's sometime optional, most of time it's required)

$_withChecksum : boolean

Default

true
inherited_from \Zend_Barcode_Object_ObjectAbstract::_withChecksum
 

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