Barcode

Barcode factory class

Namespace: Com\Tecnick\Barcode

File: Barcode.php line 36

Barcode factory class

Tags

Constants

BARCODETYPES

File: Barcode.php line 49

public array<string, string> BARCODETYPES = ['AUSPOST' => 'Australia Post 4-State Customer Barcode', 'C128' => 'CODE 128', 'C128A' => 'CODE 128 A', 'C128B' => 'CODE 128 B', 'C128C' => 'CODE 128 C', 'C16K' => 'CODE 16K (stacked CODE 128)', 'C32' => 'CODE 32 (Italian Pharmacode - IMH - Radix 32)', 'C49' => 'CODE 49 (ANSI/AIM BC6)', 'C39' => 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.', 'C39+' => 'CODE 39 + CHECKSUM', 'C39E' => 'CODE 39 EXTENDED', 'C39E+' => 'CODE 39 EXTENDED + CHECKSUM', 'C93' => 'CODE 93 - USS-93', 'CODABAR' => 'CODABAR', 'CODE11' => 'CODE 11', 'DATABAR' => 'GS1 DataBar Omnidirectional (ISO/IEC 24724)', 'DATABAREXP' => 'GS1 DataBar Expanded (ISO/IEC 24724)', 'DATABAREXPSTACK' => 'GS1 DataBar Expanded Stacked (ISO/IEC 24724)', 'DATABARLIMITED' => 'GS1 DataBar Limited (ISO/IEC 24724)', 'DATABARSTACK' => 'GS1 DataBar Stacked (ISO/IEC 24724)', 'DATABARSTACKOMNI' => 'GS1 DataBar Stacked Omnidirectional (ISO/IEC 24724)', 'DATABARTRUNC' => 'GS1 DataBar Truncated (ISO/IEC 24724)', 'EAN13' => 'EAN 13', 'EAN2' => 'EAN 2-Digits UPC-Based Extension', 'EAN5' => 'EAN 5-Digits UPC-Based Extension', 'EAN8' => 'EAN 8', 'GS114' => 'GS1-14 - EAN-14 - SCC-14 (GS1-128 with the Application Identifier 01)', 'GS1128' => 'GS1-128 (CODE 128 with GS1 Application Identifiers)', 'HIBC128' => 'HIBC in CODE 128 (ANSI/HIBC 2.6 and ANSI/HIBC 1.3)', 'HIBC39' => 'HIBC in CODE 39 (ANSI/HIBC 2.6 and ANSI/HIBC 1.3)', 'I25' => 'Interleaved 2 of 5', 'I25+' => 'Interleaved 2 of 5 + CHECKSUM', 'IDENTCODE' => 'Deutsche Post Identcode', 'IMB' => 'IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200', 'IMBPRE' => 'IMB - Intelligent Mail Barcode pre-processed', 'ITF14' => 'ITF-14 (GTIN-14 - GS1 General Specifications)', 'JPPOST' => 'Japan Post Customer Barcode', 'KIX' => 'KIX (Klant index - Customer index)', 'LEITCODE' => 'Deutsche Post Leitcode', 'LOGMARS' => 'LOGMARS (CODE 39 profile of MIL-STD-1189B)', 'LRAW' => '1D RAW MODE (comma-separated rows of 01 strings)', 'MAILMARK' => 'Royal Mail Mailmark 4-state barcode (types C and L)', 'MSI' => 'MSI (Variation of Plessey code)', 'MSI+' => 'MSI + CHECKSUM (modulo 11)', 'PHARMA' => 'PHARMACODE', 'PHARMA2T' => 'PHARMACODE TWO-TRACKS', 'PLANET' => 'PLANET', 'PLESSEY' => 'Plessey Code', 'POSTNET' => 'POSTNET', 'PZN' => 'PZN (Pharmazentralnummer - IFA coding system)', 'RMS4CC' => 'RMS4CC (Royal Mail 4-state Customer Bar Code)', 'S25' => 'Standard 2 of 5', 'S25+' => 'Standard 2 of 5 + CHECKSUM', 'S25DATALOGIC' => '2 of 5 Datalogic (China Post Code)', 'S25IATA' => '2 of 5 IATA (Computer Identics 2 of 5)', 'S25MATRIX' => '2 of 5 Matrix', 'SSCC18' => 'SSCC-18 (GS1-128 with the Application Identifier 00)', 'TELEPEN' => 'Telepen (full ASCII)', 'UPCA' => 'UPC-A', 'UPCE' => 'UPC-E', 'AZTEC' => 'AZTEC Code (ISO/IEC 24778:2008)', 'AZTECRUNE' => 'AZTEC Rune (ISO/IEC 24778:2008 Annex A)', 'DATAMATRIX' => 'DATAMATRIX (ISO/IEC 16022)', 'DMRE' => 'Data Matrix Rectangular Extension (ISO/IEC 21471)', 'HANXIN' => 'Han Xin Code (GB/T 21049, ISO/IEC 20830)', 'HIBCAZ' => 'HIBC in AZTEC Code (ANSI/HIBC 2.6 and ANSI/HIBC 1.3)', 'HIBCDM' => 'HIBC in DATAMATRIX (ANSI/HIBC 2.6 and ANSI/HIBC 1.3)', 'HIBCQR' => 'HIBC in QR-CODE (ANSI/HIBC 2.6 and ANSI/HIBC 1.3)', 'MICROQR' => 'Micro QR Code (ISO/IEC 18004)', 'PDF417' => 'PDF417 (ISO/IEC 15438:2006)', 'PDF417C' => 'Compact PDF417 - truncated (ISO/IEC 15438:2006)', 'QRCODE' => 'QR-CODE', 'SRAW' => '2D RAW MODE (comma-separated rows of 01 strings)']

MAX_CODE_LENGTH

File: Barcode.php line 42

public mixed MAX_CODE_LENGTH = 30000

Longer payloads are rejected by getBarcodeObj().

Methods

getBarcodeObj()

File: Barcode.php line 148

public getBarcodeObj(string|BarcodeType $type, string $code[, int $width = -1 ][, int $height = -1 ][, string $color = 'black' ][, array{int, int, int, int} $padding = [0, 0, 0, 0] ]) : Model

Parameters

  • $type : string|BarcodeType : Barcode type (leading token, optionally followed by comma-separated extra parameters), or a BarcodeType enum case
  • $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) or PDF spot color name
  • $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 multiplication factor for each row or column.

Tags

  • throws: Exception in case of error
  • throws: Exception in case of color parsing errors

Return values

Model