classes-Com-Tecnick-Barcode-Type-Linear-CodeOneTwoEight-CodeOneTwoEightC

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

CodeOneTwoEightC extends CodeOneTwoEight

in package

Com\Tecnick\Barcode\Type\Linear\CodeOneTwoEight\C;

CodeOneTwoEightC Barcode type class CODE 128 C

Tags
since
2015-02-21
category

Library

author

Nicola Asuni info@tecnick.com

copyright

2010-2024 Nicola Asuni - Tecnick.com LTD

license

http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)

link
https://github.com/tecnickcom/tc-lib-barcode

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
throws
Exception

in case of error

throws
Exception

in case of color error

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
string

getGd()

Get the barcode as GD image object (requires GD library)

public getGd() : GdImage
Tags
throws
Exception

if the GD library is not installed

Return values
GdImage

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<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
throws
Exception

if the Imagick library is not installed

Return values
string

getSvg()

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
throws
Exception

in case of color error

Return values
static

setColor()

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
throws
Exception

in case of color error

throws
Exception

in case of empty or transparent color

Return values
static

setSize()

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.

Return values
static
On this page
 

© 2004-2024 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy