Zend Framework
3.0
|
Class for generate Barcode. More...
Public Member Functions | |
__construct ($options=null) | |
Constructor. | |
setOptions ($options) | |
Set barcode state from options array. | |
setBarcodeNamespace ($namespace) | |
Set barcode namespace for autoloading. | |
getBarcodeNamespace () | |
Retrieve barcode namespace. | |
getType () | |
Retrieve type of barcode. | |
setBarHeight ($value) | |
Set height of the barcode bar. | |
getBarHeight () | |
Get height of the barcode bar. | |
setBarThinWidth ($value) | |
Set thickness of thin bar. | |
getBarThinWidth () | |
Get thickness of thin bar. | |
setBarThickWidth ($value) | |
Set thickness of thick bar. | |
getBarThickWidth () | |
Get thickness of thick bar. | |
setFactor ($value) | |
Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize. | |
getFactor () | |
Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize. | |
setForeColor ($value) | |
Set color of the barcode and text. | |
getForeColor () | |
Retrieve color of the barcode and text. | |
setBackgroundColor ($value) | |
Set the color of the background. | |
getBackgroundColor () | |
Retrieve background color of the image. | |
setWithBorder ($value) | |
Activate/deactivate drawing of the bar. | |
getWithBorder () | |
Retrieve if border are draw or not. | |
setWithQuietZones ($value) | |
Activate/deactivate drawing of the quiet zones. | |
getWithQuietZones () | |
Retrieve if quiet zones are draw or not. | |
setReverseColor () | |
Allow fast inversion of font/bars color and background color. | |
setOrientation ($value) | |
Set orientation of barcode and text. | |
getOrientation () | |
Retrieve orientation of barcode and text. | |
setText ($value) | |
Set text to encode. | |
getText () | |
Retrieve text to encode. | |
getRawText () | |
Retrieve text to encode. | |
getTextToDisplay () | |
Retrieve text to display. | |
setDrawText ($value) | |
Activate/deactivate drawing of text to encode. | |
getDrawText () | |
Retrieve if drawing of text to encode is enabled. | |
setStretchText ($value) | |
Activate/deactivate the adjustment of the position of the characters to the position of the bars. | |
getStretchText () | |
Retrieve if the adjustment of the position of the characters to the position of the bars is enabled. | |
setWithChecksum ($value) | |
Activate/deactivate the automatic generation of the checksum character added to the barcode text. | |
getWithChecksum () | |
Retrieve if the checksum character is automatically added to the barcode text. | |
setWithChecksumInText ($value) | |
Activate/deactivate the automatic generation of the checksum character added to the barcode text. | |
getWithChecksumInText () | |
Retrieve if the checksum character is automatically added to the barcode text. | |
setFont ($value) | |
Set the font: | |
getFont () | |
Retrieve the font. | |
setFontSize ($value) | |
Set the size of the font in case of TTF. | |
getFontSize () | |
Retrieve the size of the font in case of TTF. | |
getQuietZone () | |
Quiet zone before first bar and after the last bar. | |
getInstructions () | |
Retrieve the set of drawing instructions. | |
checkParams () | |
Checking of parameters after all settings. | |
getHeight ($recalculate=false) | |
Get height of the result object. | |
getWidth ($recalculate=false) | |
Get width of the result object. | |
getOffsetLeft ($recalculate=false) | |
Calculate the offset from the left of the object if an orientation is activated. | |
getOffsetTop ($recalculate=false) | |
Calculate the offset from the top of the object if an orientation is activated. | |
draw () | |
Complete drawing of the barcode. | |
validateText ($value) | |
Check for invalid characters. | |
Protected Member Functions | |
getDefaultOptions () | |
Set default options for particular object. | |
addLeadingZeros ($text, $withoutChecksum=false) | |
Automatically add leading zeros if barcode length is fixed. | |
addInstruction (array $instruction) | |
Add an instruction in the array of instructions. | |
addPolygon (array $points, $color=null, $filled=true) | |
Add a polygon drawing instruction in the set of instructions. | |
addText ($text, $size, $position, $font, $color, $alignment= 'center', $orientation=0) | |
Add a text drawing instruction in the set of instructions. | |
checkText ($value=null) | |
Check if a text is really provided to barcode. | |
checkRatio ($min=2, $max=3) | |
Check the ratio between the thick and the thin bar. | |
checkFontAndOrientation () | |
Drawing with an angle is just allow TTF font. | |
calculateWidth () | |
Width of the result image (before any rotation) | |
calculateBarcodeWidth () | |
Calculate the width of the barcode. | |
calculateHeight () | |
Height of the result object. | |
calculateBarcodeHeight () | |
Height of the barcode. | |
rotate ($x1, $y1) | |
Apply rotation on a point in X/Y dimensions. | |
drawBarcode () | |
Draw the barcode. | |
drawBorder () | |
Partial function to draw border. | |
drawText () | |
Partial function to draw text. | |
validateSpecificText ($value, $options=[]) | |
Standard validation for most of barcode objects. | |
prepareBarcode () | |
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 => ... | |
checkSpecificParams () | |
Checking of parameters after all settings. | |
preDrawBarcode () | |
Allow each child to draw something else. | |
postDrawBarcode () | |
Allow each child to draw something else (ex: bearer bars in interleaved 2 of 5 code) | |
Protected Attributes | |
$barcodeNamespace = 'Zend\Barcode\Object' | |
$instructions = [] | |
$type = null | |
$height = null | |
$width = null | |
$barHeight = 50 | |
$barThinWidth = 1 | |
$barThickWidth = 3 | |
$factor = 1 | |
$foreColor = 0x000000 | |
$backgroundColor = 0xFFFFFF | |
$withBorder = false | |
$withQuietZones = true | |
$mandatoryQuietZones = false | |
$orientation = 0 | |
$offsetTop = null | |
$offsetLeft = null | |
$text = null | |
$drawText = true | |
$stretchText = false | |
$font = null | |
$fontSize = 10 | |
$withChecksum = false | |
$withChecksumInText = false | |
$barcodeLength = null | |
$addLeadingZeros = true | |
$mandatoryChecksum = false | |
$substituteChecksumCharacter = 0 | |
Class for generate Barcode.
__construct | ( | $options = null | ) |
|
protected |
Add an instruction in the array of instructions.
array | $instruction |
|
protected |
Automatically add leading zeros if barcode length is fixed.
string | $text | |
bool | $withoutChecksum |
|
protected |
Add a polygon drawing instruction in the set of instructions.
array | $points | |
int | $color | |
bool | $filled |
|
protected |
Add a text drawing instruction in the set of instructions.
string | $text | |
float | $size | |
int[] | $position | |
string | $font | |
int | $color | |
string | $alignment | |
float | int | $orientation |
|
protected |
Height of the barcode.
|
abstractprotected |
Calculate the width of the barcode.
|
protected |
Height of the result object.
|
protected |
Width of the result image (before any rotation)
|
protected |
Drawing with an angle is just allow TTF font.
\Zend\Barcode\Object\Exception\ExceptionInterface |
checkParams | ( | ) |
|
protected |
Check the ratio between the thick and the thin bar.
int | $min | |
int | $max |
\Zend\Barcode\Object\Exception\ExceptionInterface |
|
abstractprotected |
Checking of parameters after all settings.
|
protected |
Check if a text is really provided to barcode.
string | null | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
draw | ( | ) |
|
protected |
Draw the barcode.
|
protected |
Partial function to draw border.
|
protected |
Partial function to draw text.
getBackgroundColor | ( | ) |
getBarcodeNamespace | ( | ) |
getBarHeight | ( | ) |
getBarThickWidth | ( | ) |
getBarThinWidth | ( | ) |
|
protected |
Set default options for particular object.
getDrawText | ( | ) |
getFactor | ( | ) |
Get factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize.
Implements ObjectInterface.
getFont | ( | ) |
getFontSize | ( | ) |
getForeColor | ( | ) |
getHeight | ( | $recalculate = false | ) |
getInstructions | ( | ) |
getOffsetLeft | ( | $recalculate = false | ) |
Calculate the offset from the left of the object if an orientation is activated.
bool | $recalculate |
Implements ObjectInterface.
getOffsetTop | ( | $recalculate = false | ) |
Calculate the offset from the top of the object if an orientation is activated.
bool | $recalculate |
Implements ObjectInterface.
getOrientation | ( | ) |
getQuietZone | ( | ) |
getRawText | ( | ) |
getStretchText | ( | ) |
Retrieve if the adjustment of the position of the characters to the position of the bars is enabled.
Implements ObjectInterface.
getText | ( | ) |
getTextToDisplay | ( | ) |
getType | ( | ) |
getWidth | ( | $recalculate = false | ) |
getWithBorder | ( | ) |
getWithChecksum | ( | ) |
Retrieve if the checksum character is automatically added to the barcode text.
Implements ObjectInterface.
getWithChecksumInText | ( | ) |
Retrieve if the checksum character is automatically added to the barcode text.
Implements ObjectInterface.
getWithQuietZones | ( | ) |
Retrieve if quiet zones are draw or not.
|
protected |
Allow each child to draw something else (ex: bearer bars in interleaved 2 of 5 code)
|
protected |
Allow each child to draw something else.
|
abstractprotected |
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 => ...
)
|
protected |
Apply rotation on a point in X/Y dimensions.
float | $x1 | x-position before rotation |
float | $y1 | y-position before rotation |
setBackgroundColor | ( | $value | ) |
Set the color of the background.
int | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setBarcodeNamespace | ( | $namespace | ) |
Set barcode namespace for autoloading.
string | $namespace |
Implements ObjectInterface.
setBarHeight | ( | $value | ) |
Set height of the barcode bar.
int | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setBarThickWidth | ( | $value | ) |
Set thickness of thick bar.
int | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setBarThinWidth | ( | $value | ) |
Set thickness of thin bar.
int | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setDrawText | ( | $value | ) |
Activate/deactivate drawing of text to encode.
bool | $value |
Implements ObjectInterface.
setFactor | ( | $value | ) |
Set factor applying to thinBarWidth - thickBarWidth - barHeight - fontSize.
int | float | string | bool | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setFont | ( | $value | ) |
Set the font:
int | string | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setFontSize | ( | $value | ) |
Set the size of the font in case of TTF.
float | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setForeColor | ( | $value | ) |
Set color of the barcode and text.
string | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setOptions | ( | $options | ) |
setOrientation | ( | $value | ) |
Set orientation of barcode and text.
int | float | string | bool | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setReverseColor | ( | ) |
setStretchText | ( | $value | ) |
Activate/deactivate the adjustment of the position of the characters to the position of the bars.
bool | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setText | ( | $value | ) |
setWithBorder | ( | $value | ) |
setWithChecksum | ( | $value | ) |
Activate/deactivate the automatic generation of the checksum character added to the barcode text.
bool | $value |
Implements ObjectInterface.
setWithChecksumInText | ( | $value | ) |
Activate/deactivate the automatic generation of the checksum character added to the barcode text.
bool | $value |
\Zend\Barcode\Object\Exception\ExceptionInterface |
Implements ObjectInterface.
setWithQuietZones | ( | $value | ) |
|
protected |
Standard validation for most of barcode objects.
string | $value | |
array | $options |
validateText | ( | $value | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |