dolibarr  7.0.0-beta
Functions
barcode.lib.php File Reference

Set of functions used for barcode generation. More...

Go to the source code of this file.

Functions

 barcode_print ($code, $encoding="ANY", $scale=2, $mode="png")
 Print barcode. More...
 
 barcode_encode ($code, $encoding)
 Encodes $code with $encoding using genbarcode OR built-in encoder if you don't have genbarcode only EAN-13/ISBN is possible. More...
 
 barcode_gen_ean_sum ($ean)
 Calculate EAN sum. More...
 
 barcode_encode_ean ($ean, $encoding="EAN-13")
 Encode EAN. More...
 
 barcode_encode_genbarcode ($code, $encoding)
 Encode result of genbarcode command. More...
 
 barcode_outimage ($text, $bars, $scale=1, $mode="png", $total_y=0, $space= '')
 Output image onto standard output, or onto disk if global filebarcode is defined. More...
 

Detailed Description

Set of functions used for barcode generation.

Definition in file barcode.lib.php.

Function Documentation

barcode_encode (   $code,
  $encoding 
)

Encodes $code with $encoding using genbarcode OR built-in encoder if you don't have genbarcode only EAN-13/ISBN is possible.

You can use the following encodings (when you have genbarcode): ANY choose best-fit (default) EAN 8 or 13 EAN-Code UPC 12-digit EAN ISBN isbn numbers (still EAN-13) 39 code 39 128 code 128 (a,b,c: autoselection) 128C code 128 (compact form for digits) 128B code 128, full printable ascii I25 interleaved 2 of 5 (only digits) 128RAW Raw code 128 (by Leonid A. Broukhis) CBR Codabar (by Leonid A. Broukhis) MSI MSI (by Leonid A. Broukhis) PLS Plessey (by Leonid A. Broukhis)

Parameters
string$codeCode
string$encodingEncoding
Returns
array array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info)

Definition at line 111 of file barcode.lib.php.

References barcode_encode_ean(), barcode_encode_genbarcode(), dol_syslog(), and print.

Referenced by barcode_print().

barcode_encode_ean (   $ean,
  $encoding = "EAN-13" 
)

Encode EAN.

Parameters
string$eanCode
string$encodingEncoding
Returns
array array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info, 'error': error message if error)

Definition at line 180 of file barcode.lib.php.

References barcode_gen_ean_sum().

Referenced by barcode_encode().

barcode_encode_genbarcode (   $code,
  $encoding 
)

Encode result of genbarcode command.

Parameters
string$codeCode
string$encodingEncoding
Returns
array array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info)

Definition at line 241 of file barcode.lib.php.

References dol_syslog().

Referenced by barcode_encode().

barcode_gen_ean_sum (   $ean)

Calculate EAN sum.

Parameters
string$eanEAN to encode
Returns
integer Sum

Definition at line 161 of file barcode.lib.php.

Referenced by barcode_encode_ean().

barcode_outimage (   $text,
  $bars,
  $scale = 1,
  $mode = "png",
  $total_y = 0,
  $space = '' 
)

Output image onto standard output, or onto disk if global filebarcode is defined.

Parameters
string$textthe text-line (<position>:<font-size>:<character> ...)
string$barswhere to place the bars (<space-width><bar-width><space-width><bar-width>...)
int$scalescale factor ( 1 < scale < unlimited (scale 50 will produce 5400x300 pixels when using EAN-13!!!))
string$modepng,gif,jpg (default='png')
int$total_ythe total height of the image ( default: scale * 60 )
array$spacedefault: $space[top] = 2 * $scale; $space[bottom]= 2 * $scale; $space[left] = 2 * $scale; $space[right] = 2 * $scale;
Returns
string|null

Definition at line 302 of file barcode.lib.php.

References print.

Referenced by barcode_print().

barcode_print (   $code,
  $encoding = "ANY",
  $scale = 2,
  $mode = "png" 
)

Print barcode.

Parameters
string$codeCode
string$encodingEncoding
integer$scaleScale
string$mode'png' or 'jpg' ...
Returns
array|string $bars array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) or string with error message

Definition at line 68 of file barcode.lib.php.

References barcode_encode(), barcode_outimage(), and dol_syslog().

Referenced by modPhpbarcode\buildBarCode().