Table of contents
Namespace: Com\Tecnick\Barcode\Type\Linear
Extends: GsOneDataBar
File: GsOneDataBarExpanded.php line 52
GsOneDataBarExpanded Barcode type class GS1 DataBar Expanded (ISO/IEC 24724)
Variable length symbol of 4 to 22 symbol characters carrying any sequence of GS1 Application Identifier element strings. The input is the bracketed form “(ai)value(ai)value…”, which is also the human readable interpretation.
The data is turned into a binary string of 12 bits per data character: the linkage flag, the encodation method, the two bits that repeat the symbol length, the compressed data field of the method and the general purpose data compaction field. The binary string is cut into (17,4) symbol characters, and the first symbol character is a check character carrying the symbol length and the modulo 211 checksum of the data character elements.
Tags
- since: 2026-09-01
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2010-2026 Nicola Asuni - Tecnick.com LTD
- license: https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE)
- link: https://github.com/tecnickcom/tc-lib-barcode
Methods
__construct()
File: Type.php line 66
public __construct(string $code[, int $width = -1 ][, int $height = -1 ][, string $color = 'black' ][, array<string|int, int|float|string> $params = [] ][, array{int, int, int, int} $padding = [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) or PDF spot color name
- $params : array<string|int, int|float|string> = []: Array containing extra parameters for the specified barcode type
- $padding : array{int, int, int, int} = [0, 0, 0, 0]: Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the number of rows or columns.
Tags
- throws: Exception in case of error
- throws: Exception in case of color error
getArray()
File: Type.php line 258
public getArray() : Rgb, 'bars': array{int, int, int, int}[]}
Return values
Rgb, ‘bars’: array{int, int, int, int}[]}
getBarsArrayXYWH()
File: Type.php line 690
public getBarsArrayXYWH() : array<int, array{float, float, float, float}>
Return values
array<int, array{float, float, float, float}>
getBarsArrayXYXY()
File: Type.php line 651
public getBarsArrayXYXY() : array<int, array{float, float, float, float}>
Return values
array<int, array{float, float, float, float}>
getExtendedCode()
File: Type.php line 284
public getExtendedCode() : string
Return values
string
getGd()
File: Type.php line 603
public getGd() : GdImage
Tags
- throws: Exception if the GD library is not installed or the image is too large
Return values
GdImage
getGrid()
File: Type.php line 635
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()
File: Convert.php line 330
public getGridArray([string $space_char = '0' ][, string $bar_char = '1' ]) : array<int, array<int, 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
array<int, array<int, string»
getHtmlDiv()
File: Type.php line 428
public getHtmlDiv() : string
Return values
string —
HTML code (DIV block)
getInlineSvgCode()
File: Type.php line 339
public getInlineSvgCode() : string
Return values
string —
Inline SVG code.
getPng()
File: Type.php line 466
public getPng([string|null $filename = null ]) : void
Parameters
- $filename : string|null = null: The file name without extension (optional). Only allows alphanumeric characters, underscores and hyphens. Defaults to a md5 hash of the data. The file extension is always ‘.png’.
Tags
- throws: Exception in case image generation fails
getPngData()
File: Type.php line 480
public getPngData([bool $imagick = true ]) : string
Parameters
- $imagick : bool = true: If true try to use the Imagick extension
Tags
- throws: Exception in case image generation fails
Return values
string —
PNG image data
getPngDataImagick()
File: Type.php line 532
public getPngDataImagick() : string
Tags
- throws: Exception if the Imagick library is not installed or the image is too large
Return values
string
getSvg()
File: Type.php line 329
public getSvg([string|null $filename = null ]) : void
Parameters
- $filename : string|null = null: The file name without extension (optional). Only allows alphanumeric characters, underscores and hyphens. Defaults to a md5 hash of the data. The file extension is always ‘.svg’.
getSvgCode()
File: Type.php line 418
public getSvgCode() : string
Return values
string —
SVG code
setBackgroundColor()
File: Type.php line 198
public setBackgroundColor(string $color) : static
Parameters
- $color : string: Background color in Web notation (color name, or hexadecimal code, or CSS syntax) or PDF spot color name
Tags
- throws: Exception in case of color error
Return values
static
setColor()
File: Type.php line 179
public setColor(string $color) : static
An empty or transparent foreground color is rejected with a BarcodeException.
Parameters
- $color : string: Foreground color in Web notation (color name, or hexadecimal code, or CSS syntax) or PDF spot color name
Tags
- throws: Exception in case of color error
- throws: Exception in case of empty or transparent color
Return values
static
setSize()
File: Type.php line 109
public setSize(int $width, int $height[, array{int, int, int, int} $padding = [0, 0, 0, 0] ]) : static
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{int, int, int, int} = [0, 0, 0, 0]: Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the number of rows or columns.
Tags
- throws: Exception in case of an empty barcode or invalid padding
Return values
static