Barcode/Object/ObjectAbstract.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 [email protected] 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 24593 2012-01-05 20:35:02Z matthew $
\Zend_Barcode_Object_ObjectAbstract
Package: Zend\BarcodeClass 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



\$_addLeadingZeros $_addLeadingZeros = true
Activate automatic addition of leading zeros
if barcode length is fixed
<p>boolean</p>
Default valuetrue
Details
- Type
- \$_addLeadingZeros



integer $_backgroundColor = 16777215
Background color of the object
Default value16777215
Details
- Type
- integer



\$_barcodeLength $_barcodeLength = null
Fix barcode length (numeric or string like 'even')
<p>integer | string</p>
Default valuenull
Details
- Type
- \$_barcodeLength



string $_barcodeNamespace = 'Zend_Barcode_Object'
Namespace of the barcode for autoloading
Default value'Zend_Barcode_Object'
Details
- Type
- string



boolean $_drawText = true
Display (or not) human readable text
Default valuetrue
Details
- Type
- boolean



integer $_factor = 1
Factor to multiply bar and font measure
(barHeight, barThinWidth, barThickWidth & fontSize)
Default value1
Details
- Type
- integer



integer|string $_font = null
Font resource
- integer (1 to 5): corresponds to GD included fonts
- string: corresponds to path of a TTF font
Default valuenull
Details
- Type
- integer | string



integer $_foreColor = 0
Font and bars color of the object
Default value0
Details
- Type
- integer



array $_instructions = array()
Set of drawing instructions
Default valuearray()
Details
- Type
- array



\$_mandatoryChecksum $_mandatoryChecksum = false
Activation of mandatory checksum
to deactivate unauthorized modification
<p>boolean</p>
Default valuefalse
Details
- Type
- \$_mandatoryChecksum



boolean $_mandatoryQuietZones = false
Force quiet zones even if
Default valuefalse
Details
- Type
- boolean



integer $_offsetLeft = null
Offset from the left the object
(calculated from the orientation)
Default valuenull
Details
- Type
- integer



integer $_offsetTop = null
Offset from the top the object
(calculated from the orientation)
Default valuenull
Details
- Type
- integer



float $_orientation = 0
Orientation of the barcode in degrees
Default value0
Details
- Type
- float



string $_staticFont = null
staticTTF font name: can be set before instanciation of the object
Default valuenull
Details
- Type
- string



boolean $_stretchText = false
Adjust (or not) position of human readable characters with barcode
Default valuefalse
Details
- Type
- boolean



\$_substituteChecksumCharacter $_substituteChecksumCharacter = 0
Character used to substitute checksum character for validation
<p>mixed</p>
Default value0
Details
- Type
- \$_substituteChecksumCharacter



boolean $_withBorder = false
Activate/deactivate border of the object
Default valuefalse
Details
- Type
- boolean



boolean $_withChecksumInText = false
Drawing of checksum inside text
Default valuefalse
Details
- Type
- boolean



boolean $_withQuietZones = true
Activate/deactivate drawing of quiet zones
Default valuetrue
Details
- Type
- boolean
Methods



_addInstruction(array $instruction) : void
Add an instruction in the array of instructions
Parameters
Name |
Type |
Description |
$instruction |
array |
|



_addLeadingZeros(string $text, boolean $withoutChecksum = false) : void
Automatically add leading zeros if barcode length is fixed
Parameters
Name |
Type |
Description |
$text |
string |
|
$withoutChecksum |
boolean |
|



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



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



_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



_checkText( $value = null) : void
Check if a text is really provided to barcode
Parameters
Name |
Type |
Description |
$value |
|
|
Throws



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



_validateText(string $value, array $options = array()) : void
Standard validation for most of barcode objects
Parameters
Name |
Type |
Description |
$value |
string |
|
$options |
array |
|



draw() : array
Complete drawing of the barcode
Returns
Type |
Description |
array |
Table of instructions |



getForeColor() : \unknown
Retrieve color of the barcode and text
Returns
Type |
Description |
\unknown |
|



getHeight( $recalculate = false) : integer
Get height of the result object
Parameters
Name |
Type |
Description |
$recalculate |
|
|
Returns



getOffsetLeft(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



getOffsetTop(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



getWidth( $recalculate = false) : integer
Get width of the result object
Parameters
Name |
Type |
Description |
$recalculate |
|
|
Returns



setBackgroundColor(integer $value) : \Zend_Barcode_Object
Set the color of the background
Parameters
Name |
Type |
Description |
$value |
integer |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|
Throws



setBarHeight(integer $value) : \Zend_Barcode_Object
Set height of the barcode bar
Parameters
Name |
Type |
Description |
$value |
integer |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|
Throws



setBarThickWidth(integer $value) : \Zend_Barcode_Object
Set thickness of thick bar
Parameters
Name |
Type |
Description |
$value |
integer |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|
Throws



setBarThinWidth(integer $value) : \Zend_Barcode_Object
Set thickness of thin bar
Parameters
Name |
Type |
Description |
$value |
integer |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|
Throws



setBarcodeFont(string $font) : void
staticSet the font for all instances of barcode
Parameters
Name |
Type |
Description |
$font |
string |
|



setBarcodeNamespace(string $namespace) : \Zend_Barcode_Object
Set barcode namespace for autoloading
Parameters
Name |
Type |
Description |
$namespace |
string |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|



setConfig(\Zend_Config $config) : \Zend_Barcode_Object
Set barcode state from config object
Parameters
Returns
Type |
Description |
\Zend_Barcode_Object |
|



setDrawText(boolean $value) : \Zend_Barcode_Object
Activate/deactivate drawing of text to encode
Parameters
Name |
Type |
Description |
$value |
boolean |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|



setFactor(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



setFont(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



setFontSize(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



setForeColor(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



setOptions(array $options) : \Zend_Barcode_Object
Set barcode state from options array
Parameters
Name |
Type |
Description |
$options |
array |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|



setOrientation(float $value) : \Zend_Barcode_Object
Set orientation of barcode and text
Parameters
Name |
Type |
Description |
$value |
float |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|
Throws



setReverseColor() : \Zend_Barcode_Object
Allow fast inversion of font/bars color and background color
Returns
Type |
Description |
\Zend_Barcode_Object |
|



setStretchText(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



setWithBorder(boolean $value) : \Zend_Barcode_Object
Activate/deactivate drawing of the bar
Parameters
Name |
Type |
Description |
$value |
boolean |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|



setWithChecksum(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 |
|



setWithChecksumInText(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



setWithQuietZones(boolean $value) : \Zend_Barcode_Object
Activate/deactivate drawing of the quiet zones
Parameters
Name |
Type |
Description |
$value |
boolean |
|
Returns
Type |
Description |
\Zend_Barcode_Object |
|



validateText(string $value) : void
Check for invalid characters
Parameters
Name |
Type |
Description |
$value |
string |
Text to be ckecked |