Com\Tecnick\Barcode\Type\Linear\Imb;
Imb Barcode type class IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
Intelligent Mail barcode is a 65-bar code for use on mail in the United States. The fields are described as follows:
- The Barcode Identifier shall be assigned by USPS to encode the presort identification that is currently printed in human readable form on the optional endorsement line (OEL) as well as for future USPS use. This shall be two digits, with the second digit in the range of 0–4. The allowable encoding ranges shall be 00–04, 10–14, 20–24, 30–34, 40–44, 50–54, 60–64, 70–74, 80–84, and 90–94.
- The Service Type Identifier shall be assigned by USPS for any combination of services requested on the mailpiece. The allowable encoding range shall be 000http://it2.php.net/manual/en/function.dechex.php–999. Each 3-digit value shall correspond to a particular mail class with a particular combination of service(s). Each service program, such as OneCode Confirm and OneCode ACS, shall provide the list of Service Type Identifier values.
- The Mailer or Customer Identifier shall be assigned by USPS as a unique, 6 or 9 digit number that identifies a business entity. The allowable encoding range for the 6 digit Mailer ID shall be 000000- 899999, while the allowable encoding range for the 9 digit Mailer ID shall be 900000000-999999999. The Serial or Sequence Number shall be assigned by the mailer for uniquely identifying and tracking mailpieces. The allowable encoding range shall be 000000000–999999999 when used with a 6 digit Mailer ID and 000000-999999 when used with a 9 digit Mailer ID. e. The Delivery Point ZIP Code shall be assigned by the mailer for routing the mailpiece. This shall replace POSTNET for routing the mailpiece to its final delivery point. The length may be 0, 5, 9, or 11 digits. The allowable encoding ranges shall be no ZIP Code, 00000–99999, 000000000–999999999, and 00000000000–99999999999. An hyphen '-' is required before the zip/delivery point.
Tags
Table of Contents
- $asc_chr : array<string|int, mixed>
- ASC characters
- $asc_pos : array<string|int, mixed>
- ASC positions
- $bars : array<string|int, mixed>
- Array containing the position and dimensions of each barcode bar (x, y, width, height)
- $bg_color_obj : Color
- Backgorund Color object
- $code : string
- Code to convert (barcode content)
- $color_obj : Color
- Foreground Color object
- $dsc_chr : array<string|int, mixed>
- DSC characters
- $dsc_pos : array<string|int, mixed>
- DSC positions
- $extcode : string
- Resulting code after applying checksum etc.
- $format : string
- Barcode format
- $height : float
- Barcode height
- $height_ratio : float
- Ratio between the barcode height and the number of columns
- $ncols : int
- Total number of columns
- $nrows : int
- Total number of rows
- $padding : array<string|int, mixed>
- Additional padding to add around the barcode (top, right, bottom, left) in user units.
- $params : array<string|int, mixed>
- Array containing extra parameters for the specified barcode type
- $type : string
- Barcode type (linear or square)
- $width : float
- Barcode width
- $width_ratio : float
- Ratio between the barcode width and the number of rows
- __construct() : mixed
- Initialize a new barcode object
- getArray() : array<string|int, mixed>
- Get the barcode raw array
- getBarsArray() : array<string|int, mixed>
- Get the array containing all the formatted bars coordinates
- getExtendedCode() : string
- Get the extended code (code + checksum)
- getGd() : object
- Get the barcode as GD image object (requires GD library)
- getGrid() : string
- Get a raw barcode string representation using characters
- getGridArray() : array<string|int, mixed>
- Get a raw barcode grid array
- getHtmlDiv() : string
- Get an HTML representation of the barcode.
- getPng() : mixed
- Get Barcode as PNG Image (requires GD or Imagick library)
- getPngData() : string
- Get the barcode as PNG image (requires GD or Imagick library)
- getPngDataImagick() : object
- Get the barcode as PNG image (requires Imagick library)
- getSvg() : mixed
- Get the barcode as SVG image object
- getSvgCode() : string
- Get the barcode as SVG code
- setBackgroundColor() : mixed
- Set the background color
- setColor() : mixed
- Set the color of the bars.
- setSize() : mixed
- Set the size of the barcode to be exported
- convertDecToHex() : string
- Convert large integer number to hexadecimal representation.
- convertHexToDec() : string
- Convert large hexadecimal number to decimal representation (string).
- getBarRectXYWH() : array<string|int, mixed>
- Get the adjusted rectangular coordinates (x,y,w,h) for the specified bar
- getBarRectXYXY() : array<string|int, mixed>
- Get the adjusted rectangular coordinates (x1,y1,x2,y2) for the specified bar
- getCharsArray() : array<string|int, mixed>
- Get the processed array of characters
- getFrameCheckSequence() : int
- Get the Frame Check Sequence
- getReversedUnsignedShort() : int
- Reverse unsigned short value
- getRgbColorObject() : Color
- Get the RGB Color object for the given color representation
- getRotatedBarArray() : array<string|int, mixed>
- Returns the bars array ordered by columns
- getRoutingCode() : string
- Get the routing code binary block
- getTables() : array<string|int, mixed>
- Get the Nof13 tables
- processBinarySequence() : mixed
- Import a binary sequence of comma-separated 01 strings
- setBars() : mixed
- Get the bars array
- setPadding() : mixed
- Set the barcode padding
- setParameters() : mixed
- Set extra (optional) parameters
Properties
$asc_chr
ASC characters
protected static array<string|int,
mixed> $asc_chr = array(4, 0, 2, 6, 3, 5, 1,
9, 8, 7, 1, 2, 0, 6, 4, 8, 2, 9, 5, 3, 0, 1, 3, 7, 4, 6, 8, 9, 2,
0, 5, 1, 9, 4, 3, 8, 6, 7, 1, 2, 4, 3, 9, 5, 7, 8, 3, 0, 2, 1, 4,
0, 9, 1, 7, 0, 2, 4, 6, 3, 7, 1, 9, 5, 8)
$asc_pos
ASC positions
protected static array<string|int,
mixed> $asc_pos = array(3, 0, 8, 11, 1, 12,
8, 11, 10, 6, 4, 12, 2, 7, 9, 6, 7, 9, 2, 8, 4, 0, 12, 7, 10, 9, 0,
7, 10, 5, 7, 9, 6, 8, 2, 12, 1, 4, 2, 0, 1, 5, 4, 6, 12, 1, 0, 9,
4, 7, 5, 10, 2, 6, 9, 11, 2, 12, 6, 7, 5, 11, 0, 3,
2)
$bars
Array containing the position and dimensions of each barcode bar (x, y, width, height)
protected array<string|int,
mixed> $bars = array()
$bg_color_obj
Backgorund Color object
protected Color $bg_color_obj
object
$code
Code to convert (barcode content)
protected string $code = ''
$color_obj
Foreground Color object
protected Color $color_obj
object
$dsc_chr
DSC characters
protected static array<string|int,
mixed> $dsc_chr = array(7, 1, 9, 5, 8, 0, 2,
4, 6, 3, 5, 8, 9, 7, 3, 0, 6, 1, 7, 4, 6, 8, 9, 2, 5, 1, 7, 5, 4,
3, 8, 7, 6, 0, 2, 5, 4, 9, 3, 0, 1, 6, 8, 2, 0, 4, 5, 9, 6, 7, 5,
2, 6, 3, 8, 5, 1, 9, 8, 7, 4, 0, 2, 6, 3)
$dsc_pos
DSC positions
protected static array<string|int,
mixed> $dsc_pos = array(2, 10, 12, 5, 9, 1,
5, 4, 3, 9, 11, 5, 10, 1, 6, 3, 4, 1, 10, 0, 2, 11, 8, 6, 1, 12, 3,
8, 6, 4, 4, 11, 0, 6, 1, 9, 11, 5, 3, 7, 3, 10, 7, 11, 8, 2, 10, 3,
5, 8, 0, 3, 12, 11, 8, 4, 5, 1, 3, 0, 7, 12, 9, 8,
10)
$extcode
Resulting code after applying checksum etc.
protected string $extcode = ''
$format
Barcode format
protected string $format = 'IMB'
$height
Barcode height
protected float $height
$height_ratio
Ratio between the barcode height and the number of columns
protected float $height_ratio
$ncols
Total number of columns
protected int $ncols = 0
$nrows
Total number of rows
protected int $nrows = 1
$padding
Additional padding to add around the barcode (top, right, bottom, left) in user units.
protected array<string|int,
mixed> $padding = array('T' => 0, 'R'
=> 0, 'B' => 0, 'L' => 0)
A negative value indicates the multiplication factor for each row or column.
$params
Array containing extra parameters for the specified barcode type
protected array<string|int,
mixed> $params
$type
Barcode type (linear or square)
protected string $type = ''
$width
Barcode width
protected float $width
$width_ratio
Ratio between the barcode width and the number of rows
protected float $width_ratio
Methods
__construct()
Initialize a new barcode object
public __construct(string $code[,
int $width
= -1
][,
int $height
= -1
][,
string $color
= 'black'
][,
array<string|int,
mixed> $params
= array()
][,
array<string|int,
mixed> $padding
= array(0, 0, 0,
0) ]) :
mixed
Parameters
- $code : string
-
Barcode content
- $width : int = -1
-
Barcode width in user units (excluding padding). A negative value indicates the multiplication factor for each column.
- $height : int = -1
-
Barcode height in user units (excluding padding). A negative value indicates the multiplication factor for each row.
- $color : string = 'black'
-
Foreground color in Web notation (color name, or hexadecimal code, or CSS syntax)
- $params : array<string|int, mixed> = array()
-
Array containing extra parameters for the specified barcode type
- $padding : array<string|int, mixed> = array(0, 0, 0, 0)
-
Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the number or rows or columns.
Tags
Return values
mixed —getArray()
Get the barcode raw array
public getArray()
: array<string|int,
mixed>
Return values
array<string|int, mixed> —getBarsArray()
Get the array containing all the formatted bars coordinates
public getBarsArray([string $type
= 'XYXY'
]) : array<string|int,
mixed>
Parameters
- $type : string = 'XYXY'
-
Type of coordinates to return: 'XYXY' or 'XYWH'
Return values
array<string|int, mixed> —getExtendedCode()
Get the extended code (code + checksum)
public getExtendedCode()
: string
Return values
string —getGd()
Get the barcode as GD image object (requires GD library)
public getGd()
: object
Tags
Return values
object —getGrid()
Get a raw barcode string representation using characters
public getGrid([string $space_char
= '0'
][,
string $bar_char
= '1'
]) : string
Parameters
- $space_char : string = '0'
-
Character or string to use for filling empty spaces
- $bar_char : string = '1'
-
Character or string to use for filling bars
Return values
string —getGridArray()
Get a raw barcode grid array
public getGridArray([string $space_char
= '0'
][,
string $bar_char
= '1'
]) : array<string|int,
mixed>
Parameters
- $space_char : string = '0'
-
Character or string to use for filling empty spaces
- $bar_char : string = '1'
-
Character or string to use for filling bars
Return values
array<string|int, mixed> —getHtmlDiv()
Get an HTML representation of the barcode.
public getHtmlDiv()
: string
Return values
string —HTML code (DIV block)
getPng()
Get Barcode as PNG Image (requires GD or Imagick library)
public getPng()
: mixed
Return values
mixed —getPngData()
Get the barcode as PNG image (requires GD or Imagick library)
public getPngData([bool $imagick
= true
]) : string
Parameters
- $imagick : bool = true
-
If true try to use the Imagick extension
Return values
string —PNG image data
getPngDataImagick()
Get the barcode as PNG image (requires Imagick library)
public getPngDataImagick()
: object
Tags
Return values
object —getSvg()
Get the barcode as SVG image object
public getSvg()
: mixed
Return values
mixed —getSvgCode()
Get the barcode as SVG code
public getSvgCode()
: string
Return values
string —SVG code
setBackgroundColor()
Set the background color
public setBackgroundColor(string $color)
: mixed
Parameters
- $color : string
-
Background color in Web notation (color name, or hexadecimal code, or CSS syntax)
Tags
Return values
mixed —setColor()
Set the color of the bars.
public setColor(string $color)
: mixed
If the color is transparent or empty it will be set to the default black color.
Parameters
- $color : string
-
Foreground color in Web notation (color name, or hexadecimal code, or CSS syntax)
Tags
Return values
mixed —setSize()
Set the size of the barcode to be exported
public setSize(int $width,
int $height[,
array<string|int,
mixed> $padding
= array(0, 0, 0,
0) ]) :
mixed
Parameters
- $width : int
-
Barcode width in user units (excluding padding). A negative value indicates the multiplication factor for each column.
- $height : int
-
Barcode height in user units (excluding padding). A negative value indicates the multiplication factor for each row.
- $padding : array<string|int, mixed> = array(0, 0, 0, 0)
-
Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the number or rows or columns.
Return values
mixed —convertDecToHex()
Convert large integer number to hexadecimal representation.
protected convertDecToHex(string $number)
: string
Parameters
- $number : string
-
Number to convert (as string)
Return values
string —hexadecimal representation
convertHexToDec()
Convert large hexadecimal number to decimal representation (string).
protected convertHexToDec(string $hex)
: string
Parameters
- $hex : string
-
Hexadecimal number to convert (as string)
Return values
string —hexadecimal representation
getBarRectXYWH()
Get the adjusted rectangular coordinates (x,y,w,h) for the specified bar
protected getBarRectXYWH(mixed $bar)
: array<string|int,
mixed>
Parameters
- $bar : mixed
Return values
array<string|int, mixed> —Bar coordinates
getBarRectXYXY()
Get the adjusted rectangular coordinates (x1,y1,x2,y2) for the specified bar
protected getBarRectXYXY(mixed $bar)
: array<string|int,
mixed>
Parameters
- $bar : mixed
Return values
array<string|int, mixed> —Bar coordinates
getCharsArray()
Get the processed array of characters
protected getCharsArray()
: array<string|int,
mixed>
Tags
Return values
array<string|int, mixed> —getFrameCheckSequence()
Get the Frame Check Sequence
protected getFrameCheckSequence(array<string|int,
mixed> $code_arr)
: int
Parameters
- $code_arr : array<string|int, mixed>
-
Array of hexadecimal values (13 bytes holding 102 bits right justified).
Return values
int —11 bit Frame Check Sequence as integer (decimal base)
getReversedUnsignedShort()
Reverse unsigned short value
protected getReversedUnsignedShort(int $num)
: int
Parameters
- $num : int
-
Value to reversr
Return values
int —reversed value
getRgbColorObject()
Get the RGB Color object for the given color representation
protected getRgbColorObject(string $color)
: Color
Parameters
- $color : string
-
Color in Web notation (color name, or hexadecimal code, or CSS syntax)
Tags
Return values
Color —object or null
getRotatedBarArray()
Returns the bars array ordered by columns
protected getRotatedBarArray()
: array<string|int,
mixed>
Return values
array<string|int, mixed> —getRoutingCode()
Get the routing code binary block
protected getRoutingCode(string $routing_code)
: string
Parameters
- $routing_code : string
-
the routing code
Tags
Return values
string —getTables()
Get the Nof13 tables
protected getTables(int $type,
int $size)
: array<string|int,
mixed>
Parameters
- $type : int
-
Table type: 2 for 2of13 table, 5 for 5of13table
- $size : int
-
Table size (78 for n=2 and 1287 for n=5)
Return values
array<string|int, mixed> —requested table
processBinarySequence()
Import a binary sequence of comma-separated 01 strings
protected processBinarySequence(string $code)
: mixed
Parameters
- $code : string
-
Code to process
Return values
mixed —setBars()
Get the bars array
protected setBars()
: mixed
Tags
Return values
mixed —setPadding()
Set the barcode padding
protected setPadding(array<string|int,
mixed> $padding)
: mixed
Parameters
- $padding : array<string|int, mixed>
-
Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the number or rows or columns.
Tags
Return values
mixed —setParameters()
Set extra (optional) parameters
protected setParameters()
: mixed