API Documentation

Barcode/Object/Postnet.php

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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Barcode  
subpackage
Object  
version
$Id: Postnet.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_Barcode_Object_Postnet

Class for generate Postnet barcode

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

Properties

Propertyprotectedarray  $_codingMap= 'array'

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

Default valuearrayDetails
Type
array

Methods

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

Add an instruction in the array of instructions

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_addInstruction()
Parameters
Name Type Description
$instruction array
methodprotected_addLeadingZeros( string $text, boolean $withoutChecksum = false ) : void

Automatically add leading zeros if barcode length is fixed

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_addLeadingZeros()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_addPolygon()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_addText()
Parameters
Name Type Description
$text string
$size float
$position array
$font string
$color integer
$alignment string
$orientation float
methodprotected_calculateBarcodeHeight( ) : integer
Returns
Type Description
integer
methodprotected_calculateBarcodeWidth( ) : integer

Width of the barcode (in pixels)

Returns
Type Description
integer
methodprotected_calculateHeight( ) : integer

Height of the result object

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_calculateHeight()
Returns
Type Description
integer
methodprotected_calculateWidth( ) : integer

Width of the result image (before any rotation)

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_calculateWidth()
Returns
Type Description
integer
methodprotected_checkFontAndOrientation( ) : void

Drawing with an angle is just allow TTF font

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_checkFontAndOrientation()
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodprotected_checkParams( ) : void

Partial check of interleaved Postnet barcode

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

Check the ratio between the thick and the thin bar

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_checkRatio()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_checkText()
Parameters
Name Type Description
$value
Throws
Exception Description
\Zend_Barcode_Object_Exception
methodprotected_drawBarcode( ) : void

Draw the barcode

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_drawBarcode()
methodprotected_drawBorder( ) : void

Partial function to draw border

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_drawBorder()
methodprotected_drawText( ) : void

Partial function to draw text

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_drawText()
methodprotected_getDefaultOptions( ) : void

Default options for Postnet barcode

methodprotected_postDrawBarcode( ) : void

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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_postDrawBarcode()
methodprotected_preDrawBarcode( ) : void

Allow each child to draw something else

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_preDrawBarcode()
methodprotected_prepareBarcode( ) : array

Prepare array to draw barcode

)

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

Apply rotation on a point in X/Y dimensions

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_rotate()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::_validateText()
Parameters
Name Type Description
$value string
$options array
methodpubliccheckParams( ) : void

Checking of parameters after all settings

Inherited from: \Zend_Barcode_Object_ObjectAbstract::checkParams()
methodpublicdraw( ) : array

Complete drawing of the barcode

Inherited from: \Zend_Barcode_Object_ObjectAbstract::draw()
Returns
Type Description
array Table of instructions
methodpublicgetBackgroundColor( ) : integer

Retrieve background color of the image

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getBackgroundColor()
Returns
Type Description
integer
methodpublicgetBarHeight( ) : integer

Get height of the barcode bar

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getBarHeight()
Returns
Type Description
integer
methodpublicgetBarThickWidth( ) : integer

Get thickness of thick bar

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getBarThickWidth()
Returns
Type Description
integer
methodpublicgetBarThinWidth( ) : integer

Get thickness of thin bar

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getBarThinWidth()
Returns
Type Description
integer
methodpublicgetBarcodeNamespace( ) : string

Retrieve barcode namespace

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getBarcodeNamespace()
Returns
Type Description
string
methodpublicgetChecksum( string $text ) : int

Get barcode checksum

Parameters
Name Type Description
$text string
Returns
Type Description
int
methodpublicgetDrawText( ) : boolean

Retrieve if drawing of text to encode is enabled

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getDrawText()
Returns
Type Description
boolean
methodpublicgetFactor( ) : integer

Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getFactor()
Returns
Type Description
integer
methodpublicgetFont( ) : integer|string

Retrieve the font

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getFont()
Returns
Type Description
integerstring
methodpublicgetFontSize( ) : float

Retrieve the size of the font in case of TTF

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getFontSize()
Returns
Type Description
float
methodpublicgetForeColor( ) : \unknown

Retrieve color of the barcode and text

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getForeColor()
Returns
Type Description
\unknown
methodpublicgetHeight(  $recalculate = false ) : integer

Get height of the result object

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getHeight()
Parameters
Name Type Description
$recalculate
Returns
Type Description
integer
methodpublicgetInstructions( ) : array

Retrieve the set of drawing instructions

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getInstructions()
Returns
Type Description
array
methodpublicgetOffsetLeft( boolean $recalculate = false ) : float

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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getOffsetLeft()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getOffsetTop()
Parameters
Name Type Description
$recalculate boolean
Returns
Type Description
float
methodpublicgetOrientation( ) : float

Retrieve orientation of barcode and text

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getOrientation()
Returns
Type Description
float
methodpublicgetQuietZone( ) : integer

Quiet zone before first bar and after the last bar

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getQuietZone()
Returns
Type Description
integer
methodpublicgetRawText( ) : string

Retrieve text to encode

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getRawText()
Returns
Type Description
string
methodpublicgetStretchText( ) : boolean

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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getStretchText()
Returns
Type Description
boolean
methodpublicgetText( ) : string

Retrieve text to encode

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getText()
Returns
Type Description
string
methodpublicgetTextToDisplay( ) : string

Retrieve text to display

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getTextToDisplay()
Returns
Type Description
string
methodpublicgetType( ) : string

Retrieve type of barcode

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getType()
Returns
Type Description
string
methodpublicgetWidth(  $recalculate = false ) : integer

Get width of the result object

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getWidth()
Parameters
Name Type Description
$recalculate
Returns
Type Description
integer
methodpublicgetWithBorder( ) : boolean

Retrieve if border are draw or not

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getWithBorder()
Returns
Type Description
boolean
methodpublicgetWithChecksum( ) : boolean

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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getWithChecksum()
Returns
Type Description
boolean
methodpublicgetWithChecksumInText( ) : boolean

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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getWithChecksumInText()
Returns
Type Description
boolean
methodpublicgetWithQuietZones( ) : boolean

Retrieve if quiet zones are draw or not

Inherited from: \Zend_Barcode_Object_ObjectAbstract::getWithQuietZones()
Returns
Type Description
boolean
methodpublicsetBackgroundColor( integer $value ) : \Zend_Barcode_Object

Set the color of the background

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setBackgroundColor()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setBarHeight()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setBarThickWidth()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setBarThinWidth()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setBarcodeFont()
Parameters
Name Type Description
$font string
methodpublicsetBarcodeNamespace( string $namespace ) : \Zend_Barcode_Object

Set barcode namespace for autoloading

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setBarcodeNamespace()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setConfig()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setDrawText()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setFactor()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setFont()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setFontSize()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setForeColor()
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

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

Set orientation of barcode and text

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setOrientation()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setReverseColor()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setStretchText()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setText()
Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Barcode_Object
methodpublicsetWithBorder( boolean $value ) : \Zend_Barcode_Object

Activate/deactivate drawing of the bar

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setWithBorder()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setWithChecksum()
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

Inherited from: \Zend_Barcode_Object_ObjectAbstract::setWithChecksumInText()
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

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

Check for invalid characters

Inherited from: \Zend_Barcode_Object_ObjectAbstract::validateText()
Parameters
Name Type Description
$value string Text to be ckecked
Documentation was generated by DocBlox 0.13.3.