com-tecnick-tcpdf

# Class: TCPDFBarcode

Source Location: /barcodes.php

### Class Overview

PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).

#### Author(s):

- Nicola Asuni

#### Version:

- 1.0.001

### Variables

- $barcode_array

### Methods

- __construct
- barcode_c128
- barcode_codabar
- barcode_code39
- barcode_ean13
- barcode_i25
- barcode_postnet
- checksum_code39
- encode_code39_ext
- getBarcodeArray
- setBarcode

### Class Details

[line 62]
PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).

#### Tags:

author: | Nicola Asuni
version: | 1.0.001
link: | http://www.tcpdf.org
name: | TCPDFBarcode
license: | LGPL

[ Top ]

### Class Variables

#### $barcode_array =

[line 68]

#### Tags:

var: | representation of barcode.
access: | protected

Type: | array

[ Top ]

### Class Methods

### constructor __construct [line 84]

`TCPDFBarcode __construct( string $code, string $type)`

This is the class constructor.

Return an array representations for common 1D barcodes:

- $arrcode['code'] code to be printed on text label
- $arrcode['maxh'] max bar height
- $arrcode['maxw'] max bar width
- $arrcode['bcode'][$k] single bar or space in $k position
- $arrcode['bcode'][$k]['t'] bar type: true = bar, false = space.
- $arrcode['bcode'][$k]['w'] bar width in units.
- $arrcode['bcode'][$k]['h'] bar height in units.
- $arrcode['bcode'][$k]['p'] bar top position (0 = top, 1 = middle)

#### Tags:

access: | public

#### Parameters:

string | $code | code to print

string

$type

type of barcode:

- C39 : CODE 39
- C39+ : CODE 39 with checksum
- C39E : CODE 39 EXTENDED
- C39E+ : CODE 39 EXTENDED with checksum
- I25 : Interleaved 2 of 5
- C128A : CODE 128 A
- C128B : CODE 128 B
- C128C : CODE 128 C
- EAN13 : EAN 13
- UPCA : UPC-A
- POSTNET : POSTNET
- CODABAR : CODABAR

[ Top ]

### method barcode_c128 [line 390]

`array barcode_c128( string $code, [string $type = 'B'])`

C128 barcodes.

#### Tags:

return: | barcode representation.
access: | protected

#### Parameters:

string | $code | code to represent.
string | $type | barcode type: A, B or C

[ Top ]

### method barcode_codabar [line 753]

`array barcode_codabar( string $code)`

CODABAR barcodes.

#### Tags:

return: | barcode representation.
access: | protected

#### Parameters:

string | $code | code to represent.

[ Top ]

### method barcode_code39 [line 166]

`array barcode_code39( string $code, [ $extended = false], [boolean $checksum = false])`

CODE 39

#### Tags:

return: | barcode representation.
access: | protected

#### Parameters:

string | $code | code to represent.
boolean | $checksum | if true add a checksum to the code
| $extended |

[ Top ]

### method barcode_ean13 [line 581]

`array barcode_ean13( string $code, [string $len = 13])`

EAN13 and UPC-A barcodes.

#### Tags:

return: | barcode representation.
access: | protected

#### Parameters:

string | $code | code to represent.
string | $len | barcode type: 13 = EAN13, 12 = UPC-A

[ Top ]

### method barcode_i25 [line 332]

`array barcode_i25( string $code, boolean $checksum)`

Interleaved 2 of 5 barcodes.

Contains digits (0 to 9) and encodes the data in the width of both bars and spaces.

#### Tags:

return: | barcode representation.
access: | protected

#### Parameters:

string | $code | code to represent.
boolean | $checksum | if true add a checksum to the code

[ Top ]

### method barcode_postnet [line 699]

`array barcode_postnet( string $code)`

POSTNET barcodes.

#### Tags:

return: | barcode representation.
access: | protected

#### Parameters:

string | $code | zip code to represent. Must be a string containing a zip code of the form DDDDD or DDDDD-DDDD.

[ Top ]

### method checksum_code39 [line 309]

`char checksum_code39( string $code)`

Calculate CODE 39 checksum (modulo 43).

#### Tags:

return: | checksum.
access: | protected

#### Parameters:

string | $code | code to represent.

[ Top ]

### method encode_code39_ext [line 259]

`encoded encode_code39_ext( string $code)`

Encode a string to be used for CODE 39 Extended mode.

#### Tags:

return: | string.
access: | protected

#### Parameters:

string | $code | code to represent.

[ Top ]

### method getBarcodeArray [line 92]

`array getBarcodeArray( )`

Return an array representations of barcode.

#### Tags:

access: | public

[ Top ]

### method setBarcode [line 102]

`array setBarcode( string $code, string $type)`

Set the barcode.

#### Tags:

access: | public

#### Parameters:

string | $code | code to print

string

$type

type of barcode:

- C39 : CODE 39
- C39+ : CODE 39 with checksum
- C39E : CODE 39 EXTENDED
- C39E+ : CODE 39 EXTENDED with checksum
- I25 : Interleaved 2 of 5
- C128A : CODE 128 A
- C128B : CODE 128 B
- C128C : CODE 128 C
- EAN13 : EAN 13
- UPCA : UPC-A
- POSTNET : POSTNET
- CODABAR : CODABAR

[ Top ]

Documentation generated on Tue, 25 Nov 2008 16:30:52 +0100 by phpDocumentor 1.4.1