Manual - BCGdatabarexpanded

Introduction

Databar Expanded (formerly RSS Expanded) encodes data based on the GS1 organization standard. Failure to comply with this standard may result in an unreadable barcode.

To see the supported characters and supported encodation modes, see the overview page.

These barcodes are always composed of an identifier followed by its value. Since the parentheses can be a possible value, you mustn't wrap the identifier with parentheses.
Databar Expanded can contain multiple identifiers. If you are using a variable length identifier, you must terminate its value by a FNC1 character unless the value ends the barcode.

The minimal height must be 34 pixels.

Identifiers list:

IdNameTypeSizeChecksum
00Serial Shipping Container Code (SSCC-18)Numeric2 + 18yes
01Shipping Container Code (SSC)Numeric2 + 14yes
02Number of containersNumeric2 + 14yes
10Batch NumberAlphanumeric2 + 1 to 20no
11Production DateDate2 + 6no
12Due dateDate2 + 6no
13Packaging DateDate2 + 6no
15Sell by Date (Quality Control)Date2 + 6no
17Expiration DateDate2 + 6no
20Product VariantNumeric2 + 2no
21Serial NumberAlphanumeric2 + 1 to 20no
240Additional Product IdentificationAlphanumeric3 + 1 to 30no
241Customer part numberAlphanumeric3 + 1 to 30no
250Second Serial NumberAlphanumeric3 + 1 to 30no
251Reference to source entityAlphanumeric3 + 1 to 30no
253Global Document Type IdentifierNumeric3 + 14 to 30no
254GLN Extension Component3 + 1 to 20no
30Quantity EachNumeric2 + 1 to 8no
310yProduct Net Weight in kgNumeric4 + 6no
311yProduct Length/1st Dimension, in metersNumeric4 + 6no
312yProduct Width/Diameter/2nd Dimension, in metersNumeric4 + 6no
313yProduct Depth/Thickness/3rd Dimension, in metersNumeric4 + 6no
314yProduct Area, in square metersNumeric4 + 6no
315yProduct Volume, in litersNumeric4 + 6no
316yproduct Volume, in cubic metersNumeric4 + 6no
320yProduct Net Weight, in poundsNumeric4 + 6no
321yProduct Length/1st Dimension, in inchesNumeric4 + 6no
322yProduct Length/1st Dimension, in feetNumeric4 + 6no
323yProduct Length/1st Dimension, in yardsNumeric4 + 6no
324yProduct Width/Diameter/2nd Dimension, in inchesNumeric4 + 6no
325yProduct Width/Diameter/2nd Dimension, in feetNumeric4 + 6no
326yProduct Width/Diameter/2nd Dimension, in yardsNumeric4 + 6no
327yProduct Depth/Thickness/3rd Dimension, in inchesNumeric4 + 6no
328yProduct Depth/Thickness/3rd Dimension, in feetNumeric4 + 6no
329yProduct Depth/Thickness/3rd Dimension, in yardsNumeric4 + 6no
330yContainer Gross Weight (Kg)Numeric4 + 6no
331yContainer Length/1st Dimension (Meters)Numeric4 + 6no
332yContainer Width/Diameter/2nd Dimension (Meters)Numeric4 + 6no
333yContainer Depth/Thickness/3rd Dimension (Meters)Numeric4 + 6no
334yContainer Area (Square Meters)Numeric4 + 6no
335yContainer Gross Volume (Liters)Numeric4 + 6no
336yContainer Gross Volume (Cubic Meters)Numeric4 + 6no
337yKilograms per square meterNumeric4 + 6no
340yContainer Gross Weight (Pounds)Numeric4 + 6no
341yContainer Length/1st Dimension, in inchesNumeric4 + 6no
342yContainer Length/1st Dimension, in feetNumeric4 + 6no
343yContainer Length/1st Dimension in, in yardsNumeric4 + 6no
344yContainer Width/Diameter/2nd Dimension, in inchesNumeric4 + 6no
345yContainer Width/Diameter/2nd Dimension, in feetNumeric4 + 6no
346yContainer Width/Diameter/2nd Dimension, in yardsNumeric4 + 6no
347yContainer Depth/Thickness/Height/3rd Dimension, in inchesNumeric4 + 6no
348yContainer Depth/Thickness/Height/3rd Dimension, in feetNumeric4 + 6no
349yContainer Depth/Thickness/Height/3rd Dimension, in yardsNumeric4 + 6no
350yProduct Area (Square Inches)Numeric4 + 6no
351yProduct Area (Square Feet)Numeric4 + 6no
352yProduct Area (Square Yards)Numeric4 + 6no
353yContainer Area (Square Inches)Numeric4 + 6no
354yContainer Area (Square Feet)Numeric4 + 6no
355yContainer Area (Square Yards)Numeric4 + 6no
356yNet Weight (Troy Ounces)Numeric4 + 6no
357yKilograms per square meterNumeric4 + 6no
360yProduct Volume (Quarts)Numeric4 + 6no
361yProduct Volume (Gallons)Numeric4 + 6no
362yContainer Gross Volume (Quarts)Numeric4 + 6no
363yContainer Gross Volume (Gallons)Numeric4 + 6no
364yProduct Volume (Cubic Inches)Numeric4 + 6no
365yProduct Volume (Cubic Feet)Numeric4 + 6no
366yProduct Volume (Cubic Yards)Numeric4 + 6no
367yContainer Gross Volume (Cubic Inches)Numeric4 + 6no
368yContainer Gross Volume (Cubic Feet)Numeric4 + 6no
369yContainer Gross Volume (Cubic Yards)Numeric4 + 6no
37Number of Units ContainedNumeric2 + 1 to 8no
390yAmount payable-single monetary areaNumeric4 + 1 to 15no
391yAmount payable with ISO currency codeNumeric4 + 4 to 18no
392yAmount payable for a Variable Measure Trade Item single monetary unitNumeric4 + 1 to 15no
393yAmount payable for a Variable Measure Trade Item - with ISO currency codeNumeric4 + 4 to 18no
400Customer Purchase Order NumberAlphanumeric3 + 1 to 30no
401Consignment numberAlphanumeric3 + 1 to 30no
402Shipment Identification NumberNumeric3 + 17no
403Routing codeAlphanumeric3 + 1 to 30no
410Ship To/Deliver To Location Code (EAN13 or DUNS code)Numeric3 + 13yes
411Bill To/Invoice Location Code (EAN13 or DUNS code)Numeric3 + 13yes
412Purchase From Location Code (EAN13 or DUNS code)Numeric3 + 13yes
413Ship for - deliver for - forward to EAN.UCC Global Location NumberNumeric3 + 13yes
414Identification of a physical location EAN.UCC Global Location NumberNumeric3 + 13yes
415EAN.UCC Global Location Number of the invoicing partyNumeric3 + 13yes
420Ship To/Deliver To Postal Code (Single Postal Authority)Alphanumeric3 + 1 to 20no
421Ship To/Deliver To Postal Code (Multiple Postal Authority)Alphanumeric3 + 4 to 12no
422Country of origin of a trade itemNumeric3 + 3no
423Country of Initial ProcessingNumeric3 + 3 to 15no
424Country of ProcessingNumeric3 + 3no
425Country of DisassemblyNumeric3 + 3no
426Country Covering full Process ChainNumeric3 + 3no
7001NATO Stock Number (NSN)Numeric4 + 13no
7002UN/ECE Meat Carcasses and Cuts ClassificationAlphanumeric4 + 1 to 30no
7003Expiration Date and TimeNumeric4 + 10 to no
7004Active PotencyNumeric4 + 1 to 4no
703sApproval Number of Processor with ISO Country CodeAlphanumeric4 + 3 to 31no
8001Roll Products - Width/Length/Core DiameterNumeric4 + 14no
8002Electronic Serial Number (ESN) for Cellular PhoneAlphanumeric4 + 1 to 20no
8003UPC/EAN Number and Serial Number of Returnable AssetAlphanumeric4 + 15 to 30no
8004UPC/EAN Serial IdentificationAlphanumeric4 + 1 to 30no
8005Price per Unit of MeasureNumeric4 + 6no
8006Identification of the component of a trade itemNumeric4 + 18no
8007International Bank Account NumberAlphanumeric4 + 1 to 30no
8008Date and Time of ProductionNumeric4 + 8 to 12no
8018EAN.UCC Global Service Relation NumberNumeric4 + 18no
8020Payment Slip Reference NumberAlphanumeric4 + 1 to 25no
8100Coupon Extended Code: Number System and OfferNumeric4 + 6no
81018101 Coupon Extended Code: Number System, Offer, End of OfferNumeric4 + 10no
8102Coupon Extended Code: Number System preceded by 0Numeric4 + 2no
8110Coupon Code Identification for Use in North AmericaAlphanumeric4 + 1 to 30no
90Mutually Agreed Between Trading PartnersAlphanumeric2 + 1 to 30no
91Internal Company CodesAlphanumeric2 + 1 to 30no
92Internal Company CodesAlphanumeric2 + 1 to 30no
93Internal Company CodesAlphanumeric2 + 1 to 30no
94Internal Company CodesAlphanumeric2 + 1 to 30no
95Internal Company CodesAlphanumeric2 + 1 to 30no
96Internal Company CodesAlphanumeric2 + 1 to 30no
97Internal Company CodesAlphanumeric2 + 1 to 30no
98Internal Company CodesAlphanumeric2 + 1 to 30no
99Internal Company CodesAlphanumeric2 + 1 to 30no

* Date is in the "YYMMDD" format.

This class inherits the BCGBarcode1D class.

Example

BCGdatabarexpanded's Methods



BCGBarcode1D's Methods



BCGBarcode's Methods

Code Example

<?php
require('class/BCGFontFile.php');
require('class/BCGColor.php');
require('class/BCGDrawing.php');
require('class/BCGdatabarexpanded.barcode.php');
 
$font = new BCGFontFile('./class/font/Arial.ttf', 18);
$color_black = new BCGColor(0, 0, 0);
$color_white = new BCGColor(255, 255, 255);
 
// Barcode Part
$code = new BCGdatabarexpanded();
$code->setScale(2);
$code->setThickness(30);
$code->setForegroundColor($color_black);
$code->setBackgroundColor($color_white);
$code->setFont($font);
$code->parse('0190012345678908');
 
// Drawing Part
$drawing = new BCGDrawing('', $color_white);
$drawing->setBarcode($code);
$drawing->draw();
 
header('Content-Type: image/png');
 
$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
?>

Methods Explanation

  • getLinkageFlag() — Gets if the linkage flag is active
    Description
    Gets if the linkage flag is active.
    Returns
    bool
  • setLinkageFlag($linkageFlag) — Specifies to use the linkage flag
    Description
    Specifies to use the linkage flag, it is used in conjunction with a UCC/EAN barcode.
    Setting this property to true won't change the size of your barcode.
    The default value is false.
  • setStacked($stackedRow) — Sets the number of desired rows
    Description
    Sets the number of desired rows. The maximum number allowed is 11.
    Some values won't be possible; if you are using a fixed length encodation, the maximum number of rows will be 2.
    If the linkage flag is activated, the width of the barcode must be at least 102 pixels.
    The default value is 1.
  • getThickness() — Returns the thickness of the barcode
    Description
    The thickness of the barcode in pixels. The value isn't multiplied by the scale.
    Returns
    int - value in pixels
  • setThickness($thickness) — Specifies the thickness of the barcode
    Description
    The thickness of the barcode in pixels. This is the vertical size.
    This value is multiplied by the scale. Check the setScale() method.
    The default value is 30.
  • getLabel() — Gets the label
    Description
    Returns the real value that will be displayed with the barcode. You have to have called the parse() method first.
    Returns
    string - final label
  • setLabel($label) — Sets the label
    Description
    The text label will be written below or above the barcode depending on the barcode. You can write the special value BCGBarcode1D::AUTO_LABEL if you would like your text to be chosen automatically. It will be the value passed to the parse() method.
  • getFont() — Gets the text font for the label
    Description
    Gets the text font of the label.
    Returns
  • setFont($font) — Sets the text font for the label
    Description
    The value of the argument can be either an instance of the BCGFontFile class, BCGFontPhp, or a number between 1 and 5.
    If you are using numbers 1 through 5, PHP fonts are used. Check the PHP Manual.
  • getChecksum() — Gets the checksum appended to the barcode
    Description
    Returns the value that will be appended to the barcode. This method must be called after the method parse().
    Returns
    int - checksum added or false if no checkum is included
  • setDisplayChecksum($display) — Specifies the checksum to be added to the label
    Description
    Setting true will append the checksum to the default label.
    The default value is true.
  • parse($text) — Analyzes a $text message to draw afterwards
    Description
    The data you pass to the $text argument must be supported by the type of barcode you use.
    Check each barcode's introduction section to obtain more information on how to use this method within each symbology.
  • draw($im) — Draws the barcode on the $im
    Description
    The value of the $im argument must be a GD2 image resource. The size of the image can be defined by the value received from getDimension().
  • getDimension($w, $h) — Returns an array containing the required size for the image
    Description
    Returns an array in which the first index is the image width and the second index is the image height.
    The arguments are used to specify the starting point of the drawing. Should be 0 for both.
    The BCGDrawing class uses this method to create the image resource.
    Returns
    array(int, int) - [0] is the width, [1] is the height
  • getScale() — Gets the scale of the barcode
    Description
    Gets the scale of the barcode. The value is the number of the "smallest" unit in pixel.
    Returns
    int - value in pixels
  • setScale($x) — Sets the scale of the barcode
    Description
    The barcode will be $x times bigger. Then a pixel will be $x by $x for its size.
  • getForegroundColor() — Gets the color of the spaces
    Description
    Gets the color of the spaces of the barcode.
    Returns
  • setForegroundColor($color) — Sets the color of the spaces
    Description
    Sets the color of the spaces of the barcode. By default, the color is white. This argument can be a BCGColor class or any other argument that BCGColor can accept in its constructor.
  • getBackgroundColor() — Gets the color of the bars
    Description
    Gets the color of the bars of the barcode.
    Returns
  • setBackgroundColor($color) — Sets the color of the bars
    Description
    Sets the color of the bars of the barcode. By default, the color is black. This argument can be a BCGColor class or any other argument that BCGColor can accept in its constructor.
  • setColor($fg, $bg) — Sets the color of the bars and spaces
    Description
    An easy and fast method to set the color of the bars and spaces. Check the setForegroundColor() and setBackgroundColor().
  • getOffsetX() — Gets the X offset
    Description
    Gets the X offset of the barcode in pixels. The value isn't multiplied by the scale.
    Returns
    int - value in pixels
  • setOffsetX($v) — Sets the X offset
    Description
    Specifies the X offset of the barcode in pixels multiplied by the scale. The required size returned by getDimension() will be modified accordingly.
  • getOffsetY() — Gets the Y offset
    Description
    Gets the Y offset of the barcode in pixels. The value isn't multiplied by the scale.
    Returns
    int - value in pixels
  • setOffsetY($v) — Sets the Y offset
    Description
    Specifies the Y offset of the barcode in pixels multiplied by the scale. The required size returned by getDimension() will be modified accordingly.
  • addLabel($label) — Adds a label to the graphic
    Description
    Adds a BCGLabel object to the drawing.
  • removeLabel($label) — Removes a label from the graphic
    Description
    Removes a specific BCGLabel object from the drawing.
  • clearLabels() — Removes the labels from the graphic
    Description
    Clears the BCGLabel objects from the drawing.