Class for generate UpcA 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_Ean13

 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
inherited_from \Zend_Barcode_Object_Ean13::getChecksum()

Parameters

$text

string

Returns

integer

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

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

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_Upce
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_Upce

Set height of the barcode bar

setBarHeight(integer $value) : \Zend_Barcode_Object_Upce
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_Upce

Set thickness of thick bar

setBarThickWidth(integer $value) : \Zend_Barcode_Object_Upce
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_Upce

Set thickness of thin bar

setBarThinWidth(integer $value) : \Zend_Barcode_Object_Upce
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_Upce

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

Parameters

$namespace

string

Returns

\Zend_Barcode_Object_Upce

Set barcode state from config object

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

Parameters

$config

\Zend_Config

Returns

\Zend_Barcode_Object_Upce

Activate/deactivate drawing of text to encode

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

Parameters

$value

boolean

Returns

\Zend_Barcode_Object_Upce

Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

setFactor(integer|float|string|boolean $value) : \Zend_Barcode_Object_Upce
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_Upce

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_Upce
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_Upce

Set the size of the font in case of TTF

setFontSize(float $value) : \Zend_Barcode_Object_Upce
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_Upce

Set color of the barcode and text

setForeColor(string $value) : \Zend_Barcode_Object_Upce
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_Upce

Set barcode state from options array

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

Parameters

$options

array

Returns

\Zend_Barcode_Object_Upce

Set orientation of barcode and text

setOrientation(integer|float|string|boolean $value) : \Zend_Barcode_Object_Upce
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_Upce

Allow fast inversion of font/bars color and background color

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

Returns

\Zend_Barcode_Object_Upce

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

setStretchText(boolean $value) : \Zend_Barcode_Object_Upce
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_Upce

Set text to encode

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

Parameters

$value

string

Returns

\Zend_Barcode_Object_Upce

Activate/deactivate drawing of the bar

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

Parameters

$value

boolean

Returns

\Zend_Barcode_Object_Upce

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

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

Parameters

$value

boolean

Returns

\Zend_Barcode_Object_Upce

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

setWithChecksumInText(boolean $value) : \Zend_Barcode_Object_Upce
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_Upce

Activate/deactivate drawing of the quiet zones

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

Parameters

$value

boolean

Returns

\Zend_Barcode_Object_Upce

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_Ean13::_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

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

Draw the barcode

_drawBarcode() 
Inherited

Partial function to draw border

_drawBorder() 
Inherited

_drawEan13Text()

_drawEan13Text() 
Inherited

Partial function to draw text

_drawText() : void
inherited_from \Zend_Barcode_Object_Ean13::_drawText()

Partial function to draw text

_drawText() 
Inherited

Default options for Postnet barcode

_getDefaultOptions() : void
inherited_from \Zend_Barcode_Object_Ean13::_getDefaultOptions()

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

Prepare array to draw barcode

_prepareBarcode() : array

.. )

inherited_from \Zend_Barcode_Object_Ean13::_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

Particular validation for Upce barcode objects (to suppress checksum character substitution)

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

Parameters

$value

string

$options

array

Exceptions

\Zend_Barcode_Object_Exception

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'
 

Coding map - 0 = narrow bar - 1 = wide bar

$_codingMap : array

Default

array('A' => array(0 => "0001101", 1 => "0011001", 2 => "0010011", 3 => "0111101", 4 => "0100011", 5 => "0110001", 6 => "0101111", 7 => "0111011", 8 => "0110111", 9 => "0001011"), 'B' => array(0 => "0100111", 1 => "0110011", 2 => "0011011", 3 => "0100001", 4 => "0011101", 5 => "0111001", 6 => "0000101", 7 => "0010001", 8 => "0001001", 9 => "0010111"), 'C' => array(0 => "1110010", 1 => "1100110", 2 => "1101100", 3 => "1000010", 4 => "1011100", 5 => "1001110", 6 => "1010000", 7 => "1000100", 8 => "1001000", 9 => "1110100"))
 

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
 

$_parities

$_parities 

Default

array(0 => array(0 => array('B', 'B', 'B', 'A', 'A', 'A'), 1 => array('B', 'B', 'A', 'B', 'A', 'A'), 2 => array('B', 'B', 'A', 'A', 'B', 'A'), 3 => array('B', 'B', 'A', 'A', 'A', 'B'), 4 => array('B', 'A', 'B', 'B', 'A', 'A'), 5 => array('B', 'A', 'A', 'B', 'B', 'A'), 6 => array('B', 'A', 'A', 'A', 'B', 'B'), 7 => array('B', 'A', 'B', 'A', 'B', 'A'), 8 => array('B', 'A', 'B', 'A', 'A', 'B'), 9 => array('B', 'A', 'A', 'B', 'A', 'B')), 1 => array(0 => array('A', 'A', 'A', 'B', 'B', 'B'), 1 => array('A', 'A', 'B', 'A', 'B', 'B'), 2 => array('A', 'A', 'B', 'B', 'A', 'B'), 3 => array('A', 'A', 'B', 'B', 'B', 'A'), 4 => array('A', 'B', 'A', 'A', 'B', 'B'), 5 => array('A', 'B', 'B', 'A', 'A', 'B'), 6 => array('A', 'B', 'B', 'B', 'A', 'A'), 7 => array('A', 'B', 'A', 'B', 'A', 'B'), 8 => array('A', 'B', 'A', 'B', 'B', 'A'), 9 => array('A', 'B', 'B', 'A', 'B', 'A')))
inherited_from \Zend_Barcode_Object_Ean13::_parities
 

$_parities

$_parities 

Default

array(0 => array('A', 'A', 'A', 'A', 'A', 'A'), 1 => array('A', 'A', 'B', 'A', 'B', 'B'), 2 => array('A', 'A', 'B', 'B', 'A', 'B'), 3 => array('A', 'A', 'B', 'B', 'B', 'A'), 4 => array('A', 'B', 'A', 'A', 'B', 'B'), 5 => array('A', 'B', 'B', 'A', 'A', 'B'), 6 => array('A', 'B', 'B', 'B', 'A', 'A'), 7 => array('A', 'B', 'A', 'B', 'A', 'B'), 8 => array('A', 'B', 'A', 'B', 'B', 'A'), 9 => array('A', 'B', 'B', 'A', 'B', 'A'))
 

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

$_withChecksum : boolean

Default

false
 

Drawing of checksum inside text

$_withChecksumInText : boolean

Default

false
 

Activate/deactivate drawing of quiet zones

$_withQuietZones : boolean

Default

true