Raw extends Type
in package
Com\Tecnick\Barcode\Type\Raw
Raw Barcode type class RAW MODE (comma-separated rows)
Tags
Table of Contents
Methods
- __construct() : mixed
- Initialize a new barcode object
- getArray() : Rgb, bars: array{: int, : int, : int, : int}[]}
- Get the barcode raw array
- getBarsArrayXYWH() : array<int, array{: float, : float, : float, : float}>
- Get the array containing all the formatted bars coordinates
- getBarsArrayXYXY() : array<int, array{: float, : float, : float, : float}>
- Get the array containing all the formatted bars coordinates
- getExtendedCode() : string
- Get the extended code (code + checksum)
- getGd() : GdImage
- Get the barcode as GD image object (requires GD library)
- getGrid() : string
- Get a raw barcode string representation using characters
- getGridArray() : array<int, array<int, string>>
- Get a raw barcode grid array
- getHtmlDiv() : string
- Get an HTML representation of the barcode.
- getPng() : void
- Get Barcode as PNG Image (requires GD or Imagick library)
- getPngData() : string
- Get the barcode as PNG image (requires GD or Imagick library)
- getPngDataImagick() : string
- Get the barcode as PNG image (requires Imagick library)
- getSvg() : void
- Get the barcode as SVG image object
- getSvgCode() : string
- Get the barcode as SVG code
- setBackgroundColor() : static
- Set the background color
- setColor() : static
- Set the color of the bars.
- setSize() : static
- Set the size of the barcode to be exported
Methods
__construct()
Initialize a new barcode object
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)
- $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 or rows or columns.
Tags
getArray()
Get the barcode raw array
public getArray()
:
Rgb, bars: array{: int, : int, : int, :
int}[]}
Return values
Rgb, bars: array{: int, : int, : int, : int}[]}getBarsArrayXYWH()
Get the array containing all the formatted bars coordinates
public getBarsArrayXYWH()
: array<int, array{:
float, : float, : float, : float}>
Return values
array<int, array{: float, : float, : float, : float}>getBarsArrayXYXY()
Get the array containing all the formatted bars coordinates
public getBarsArrayXYXY()
: array<int, array{:
float, : float, : float, : float}>
Return values
array<int, array{: float, : float, : float, : float}>getExtendedCode()
Get the extended code (code + checksum)
public getExtendedCode()
: string
Return values
stringgetGd()
Get the barcode as GD image object (requires GD library)
public getGd()
: GdImage
Tags
Return values
GdImagegetGrid()
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
stringgetGridArray()
Get a raw barcode grid array
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()
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([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()
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()
: string
Tags
Return values
stringgetSvg()
Get the barcode as SVG image object
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()
Get the barcode as SVG code
public getSvgCode()
: string
Return values
string —SVG code
setBackgroundColor()
Set the background color
public setBackgroundColor(string $color)
: static
Parameters
- $color : string
-
Background color in Web notation (color name, or hexadecimal code, or CSS syntax)
Tags
Return values
staticsetColor()
Set the color of the bars.
public setColor(string $color)
: static
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
staticsetSize()
Set the size of the barcode to be exported
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 or rows or columns.