API Documentation

Zend/Barcode/Object/ObjectAbstract.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Barcode  
Subpackage
Object  
Version
$Id: ObjectAbstract.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Barcode_Object_ObjectAbstract

Package: Zend\Barcode

Class for generate Barcode

Children
\Zend_Barcode_Object_Code25
\Zend_Barcode_Object_Code39
\Zend_Barcode_Object_Error
\Zend_Barcode_Object_Postnet
\Zend_Barcode_Object_Code128
\Zend_Barcode_Object_Royalmail
\Zend_Barcode_Object_Ean13
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotected\$_addLeadingZeros  $_addLeadingZeros= 'true'

Activate automatic addition of leading zeros if barcode length is fixed

boolean
Default valuetrueDetails
Type
\$_addLeadingZeros
Propertyprotectedinteger  $_backgroundColor= '0xFFFFFF'

Background color of the object

Default value0xFFFFFFDetails
Type
integer
Propertyprotectedinteger  $_barHeight= '50'

Height of the bar

Default value50Details
Type
integer
Propertyprotectedinteger  $_barThickWidth= '3'

Width of a thick bar

Default value3Details
Type
integer
Propertyprotectedinteger  $_barThinWidth= '1'

Width of a thin bar

Default value1Details
Type
integer
Propertyprotected\$_barcodeLength  $_barcodeLength= 'null'

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

integer | string
Default valuenullDetails
Type
\$_barcodeLength
Propertyprotectedstring  $_barcodeNamespace= ''Zend_Barcode_Object''

Namespace of the barcode for autoloading

Default value'Zend_Barcode_Object'Details
Type
string
Propertyprotectedboolean  $_drawText= 'true'

Display (or not) human readable text

Default valuetrueDetails
Type
boolean
Propertyprotectedinteger  $_factor= '1'

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

Default value1Details
Type
integer
Propertyprotectedinteger|string  $_font= 'null'

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

Default valuenullDetails
Type
integerstring
Propertyprotectedfloat  $_fontSize= '10'

Font size

Default value10Details
Type
float
Propertyprotectedinteger  $_foreColor= '0x000000'

Font and bars color of the object

Default value0x000000Details
Type
integer
Propertyprotectedinteger  $_height= 'null'

Height of the object

Default valuenullDetails
Type
integer
Propertyprotectedarray  $_instructions= 'array()'

Set of drawing instructions

Default valuearray()Details
Type
array
Propertyprotected\$_mandatoryChecksum  $_mandatoryChecksum= 'false'

Activation of mandatory checksum to deactivate unauthorized modification

boolean
Default valuefalseDetails
Type
\$_mandatoryChecksum
Propertyprotectedboolean  $_mandatoryQuietZones= 'false'

Force quiet zones even if

Default valuefalseDetails
Type
boolean
Propertyprotectedinteger  $_offsetLeft= 'null'

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

Default valuenullDetails
Type
integer
Propertyprotectedinteger  $_offsetTop= 'null'

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

Default valuenullDetails
Type
integer
Propertyprotectedfloat  $_orientation= '0'

Orientation of the barcode in degrees

Default value0Details
Type
float
Propertyprotectedstring  $_staticFont= 'null'
static

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

Default valuenullDetails
Type
string
Propertyprotectedboolean  $_stretchText= 'false'

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

Default valuefalseDetails
Type
boolean
Propertyprotected\$_substituteChecksumCharacter  $_substituteChecksumCharacter= '0'

Character used to substitute checksum character for validation

mixed
Default value0Details
Type
\$_substituteChecksumCharacter
Propertyprotectedstring  $_text= 'null'

Text to display

Default valuenullDetails
Type
string
Propertyprotectedstring  $_type= 'null'

Barcode type

Default valuenullDetails
Type
string
Propertyprotectedinteger  $_width= 'null'

Width of the object

Default valuenullDetails
Type
integer
Propertyprotectedboolean  $_withBorder= 'false'

Activate/deactivate border of the object

Default valuefalseDetails
Type
boolean
Propertyprotectedboolean  $_withChecksum= 'false'

Drawing of checksum

Default valuefalseDetails
Type
boolean
Propertyprotectedboolean  $_withChecksumInText= 'false'

Drawing of checksum inside text

Default valuefalseDetails
Type
boolean
Propertyprotectedboolean  $_withQuietZones= 'true'

Activate/deactivate drawing of quiet zones

Default valuetrueDetails
Type
boolean

Methods

methodpublic__construct( array|\Zend_Config $options = null ) : void

Constructor

Parameters
Name Type Description
$options array|\Zend_Config
methodprotected_addInstruction( array $instruction ) : void

Add an instruction in the array of instructions

Parameters
Name Type Description
$instruction array
methodprotected_addLeadingZeros( string $text, boolean $withoutChecksum = false ) : void

Automatically add leading zeros if barcode length is fixed

Parameters
Name Type Description
$text string
$withoutChecksum boolean
methodprotected_addPolygon( array $points, integer $color = null, boolean $filled = true ) : void

Add a polygon drawing instruction in the set of instructions

Parameters
Name Type Description
$points array
$color integer
$filled boolean
methodprotected_addText( string $text, float $size, array $position, string $font, integer $color, string $alignment = 'center', float $orientation = 0 ) : void

Add a text drawing instruction in the set of instructions

Parameters
Name Type Description
$text string
$size float
$position array
$font string
$color integer
$alignment string
$orientation float
methodprotected_calculateBarcodeHeight( ) : integer

Height of the barcode

Returns
Type Description
integer
methodprotected_calculateBarcodeWidth( ) : integer
abstract

Calculate the width of the barcode

Returns
Type Description
integer
methodprotected_calculateHeight( ) : integer

Height of the result object

Returns
Type Description
integer
methodprotected_calculateWidth( ) : integer

Width of the result image (before any rotation)

Returns
Type Description
integer
methodprotected_checkFontAndOrientation( ) : void

Drawing with an angle is just allow TTF font

Throws
Exception Description
\Zend_Barcode_Object_Exception
methodprotected_checkParams( ) : void
abstract

Checking of parameters after all settings

methodprotected_checkRatio( integer $min = 2, integer $max = 3 ) : void

Check the ratio between the thick and the thin bar

Parameters
Name Type Description
$min integer
$max integer
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodprotected_checkText(  $value = null ) : void

Check if a text is really provided to barcode

Parameters
Name Type Description
$value
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodprotected_drawBarcode( ) : void

Draw the barcode

methodprotected_drawBorder( ) : void

Partial function to draw border

methodprotected_drawText( ) : void

Partial function to draw text

methodprotected_getDefaultOptions( ) : void

Set default options for particular object

methodprotected_postDrawBarcode( ) : void

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

methodprotected_preDrawBarcode( ) : void

Allow each child to draw something else

methodprotected_prepareBarcode( ) : array
abstract

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 => ...

)

Returns
Type Description
array
methodprotected_rotate( float $x1, float $y1 ) : array

Apply rotation on a point in X/Y dimensions

Parameters
Name Type Description
$x1 float

x-position before rotation

$y1 float

y-position before rotation

Returns
Type Description
array Array of two elements corresponding to the new XY point
methodprotected_validateText( string $value, array $options = array() ) : void

Standard validation for most of barcode objects

Parameters
Name Type Description
$value string
$options array
methodpubliccheckParams( ) : void

Checking of parameters after all settings

methodpublicdraw( ) : array

Complete drawing of the barcode

Returns
Type Description
array Table of instructions
methodpublicgetBackgroundColor( ) : integer

Retrieve background color of the image

Returns
Type Description
integer
methodpublicgetBarHeight( ) : integer

Get height of the barcode bar

Returns
Type Description
integer
methodpublicgetBarThickWidth( ) : integer

Get thickness of thick bar

Returns
Type Description
integer
methodpublicgetBarThinWidth( ) : integer

Get thickness of thin bar

Returns
Type Description
integer
methodpublicgetBarcodeNamespace( ) : string

Retrieve barcode namespace

Returns
Type Description
string
methodpublicgetDrawText( ) : boolean

Retrieve if drawing of text to encode is enabled

Returns
Type Description
boolean
methodpublicgetFactor( ) : integer

Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

Returns
Type Description
integer
methodpublicgetFont( ) : integer|string

Retrieve the font

Returns
Type Description
integer|string
methodpublicgetFontSize( ) : float

Retrieve the size of the font in case of TTF

Returns
Type Description
float
methodpublicgetForeColor( ) : \unknown

Retrieve color of the barcode and text

Returns
Type Description
\unknown
methodpublicgetHeight(  $recalculate = false ) : integer

Get height of the result object

Parameters
Name Type Description
$recalculate
Returns
Type Description
integer
methodpublicgetInstructions( ) : array

Retrieve the set of drawing instructions

Returns
Type Description
array
methodpublicgetOffsetLeft( boolean $recalculate = false ) : float

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

Parameters
Name Type Description
$recalculate boolean
Returns
Type Description
float
methodpublicgetOffsetTop( boolean $recalculate = false ) : float

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

Parameters
Name Type Description
$recalculate boolean
Returns
Type Description
float
methodpublicgetOrientation( ) : float

Retrieve orientation of barcode and text

Returns
Type Description
float
methodpublicgetQuietZone( ) : integer

Quiet zone before first bar and after the last bar

Returns
Type Description
integer
methodpublicgetRawText( ) : string

Retrieve text to encode

Returns
Type Description
string
methodpublicgetStretchText( ) : boolean

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

Returns
Type Description
boolean
methodpublicgetText( ) : string

Retrieve text to encode

Returns
Type Description
string
methodpublicgetTextToDisplay( ) : string

Retrieve text to display

Returns
Type Description
string
methodpublicgetType( ) : string

Retrieve type of barcode

Returns
Type Description
string
methodpublicgetWidth(  $recalculate = false ) : integer

Get width of the result object

Parameters
Name Type Description
$recalculate
Returns
Type Description
integer
methodpublicgetWithBorder( ) : boolean

Retrieve if border are draw or not

Returns
Type Description
boolean
methodpublicgetWithChecksum( ) : boolean

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

Returns
Type Description
boolean
methodpublicgetWithChecksumInText( ) : boolean

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

Returns
Type Description
boolean
methodpublicgetWithQuietZones( ) : boolean

Retrieve if quiet zones are draw or not

Returns
Type Description
boolean
methodpublicsetBackgroundColor( integer $value ) : \Zend_Barcode_Object

Set the color of the background

Parameters
Name Type Description
$value integer
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetBarHeight( integer $value ) : \Zend_Barcode_Object

Set height of the barcode bar

Parameters
Name Type Description
$value integer
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetBarThickWidth( integer $value ) : \Zend_Barcode_Object

Set thickness of thick bar

Parameters
Name Type Description
$value integer
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetBarThinWidth( integer $value ) : \Zend_Barcode_Object

Set thickness of thin bar

Parameters
Name Type Description
$value integer
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetBarcodeFont( string $font ) : void
static

Set the font for all instances of barcode

Parameters
Name Type Description
$font string
methodpublicsetBarcodeNamespace( string $namespace ) : \Zend_Barcode_Object

Set barcode namespace for autoloading

Parameters
Name Type Description
$namespace string
Returns
Type Description
\Zend_Barcode_Object
methodpublicsetConfig( \Zend_Config $config ) : \Zend_Barcode_Object

Set barcode state from config object

Parameters
Name Type Description
$config \Zend_Config
Returns
Type Description
\Zend_Barcode_Object
methodpublicsetDrawText( boolean $value ) : \Zend_Barcode_Object

Activate/deactivate drawing of text to encode

Parameters
Name Type Description
$value boolean
Returns
Type Description
\Zend_Barcode_Object
methodpublicsetFactor( float $value ) : \Zend_Barcode_Object

Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

Parameters
Name Type Description
$value float
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetFont( integer|string $value ) : \Zend_Barcode_Object

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

Parameters
Name Type Description
$value integer|string
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetFontSize( float $value ) : \Zend_Barcode_Object

Set the size of the font in case of TTF

Parameters
Name Type Description
$value float
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetForeColor( string $value ) : \Zend_Barcode_Object

Set color of the barcode and text

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetOptions( array $options ) : \Zend_Barcode_Object

Set barcode state from options array

Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_Barcode_Object
methodpublicsetOrientation( float $value ) : \Zend_Barcode_Object

Set orientation of barcode and text

Parameters
Name Type Description
$value float
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetReverseColor( ) : \Zend_Barcode_Object

Allow fast inversion of font/bars color and background color

Returns
Type Description
\Zend_Barcode_Object
methodpublicsetStretchText( boolean $value ) : \Zend_Barcode_Object

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

Parameters
Name Type Description
$value boolean
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetText( string $value ) : \Zend_Barcode_Object

Set text to encode

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Barcode_Object
methodpublicsetWithBorder( boolean $value ) : \Zend_Barcode_Object

Activate/deactivate drawing of the bar

Parameters
Name Type Description
$value boolean
Returns
Type Description
\Zend_Barcode_Object
methodpublicsetWithChecksum( boolean $value ) : \Zend_Barcode_Object

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

Parameters
Name Type Description
$value boolean
Returns
Type Description
\Zend_Barcode_Object
methodpublicsetWithChecksumInText( boolean $value ) : \Zend_Barcode_Object

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

Parameters
Name Type Description
$value boolean
Returns
Type Description
\Zend_Barcode_Object
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodpublicsetWithQuietZones( boolean $value ) : \Zend_Barcode_Object

Activate/deactivate drawing of the quiet zones

Parameters
Name Type Description
$value boolean
Returns
Type Description
\Zend_Barcode_Object
methodpublicvalidateText( string $value ) : void

Check for invalid characters

Parameters
Name Type Description
$value string

Text to be ckecked

Documentation was generated by DocBlox 0.15.1.