Table of contents
Namespace: Com\Tecnick\Barcode
File: Model.php line 38
Barcode Model interface
Tags
- since: 2015-02-21
- category: Library
- author: Nicola Asuni info@tecnick.com
- copyright: 2015-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
getArray()
File: Model.php line 101
public getArray() : Rgb, 'bars': array{int, int, int, int}[]}
Return values
Rgb, ‘bars’: array{int, int, int, int}[]}
getBarsArrayXYWH()
File: Model.php line 202
public getBarsArrayXYWH() : array<int, array{float, float, float, float}>
Return values
array<int, array{float, float, float, float}>
getBarsArrayXYXY()
File: Model.php line 195
public getBarsArrayXYXY() : array<int, array{float, float, float, float}>
Return values
array<int, array{float, float, float, float}>
getExtendedCode()
File: Model.php line 106
public getExtendedCode() : string
Return values
string
getGd()
File: Model.php line 170
public getGd() : GdImage
Tags
- throws: Exception if the GD library is not installed
Return values
GdImage
getGrid()
File: Model.php line 178
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: Model.php line 188
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: Model.php line 137
public getHtmlDiv() : string
Return values
string —
HTML code (DIV block)
getInlineSvgCode()
File: Model.php line 123
public getInlineSvgCode() : string
Return values
string —
Inline SVG code.
getPng()
File: Model.php line 147
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’.
getPngData()
File: Model.php line 156
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()
File: Model.php line 163
public getPngDataImagick() : string
Tags
- throws: Exception if the Imagick library is not installed
Return values
string
getSvg()
File: Model.php line 116
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: Model.php line 130
public getSvgCode() : string
Return values
string —
SVG code
setBackgroundColor()
File: Model.php line 76
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: Model.php line 66
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: Model.php line 54
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.
Return values
static