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:
| Id | Name | Type | Size | Checksum |
| 00 | Serial Shipping Container Code (SSCC-18) | Numeric | 2 + 18 | yes |
| 01 | Shipping Container Code (SSC) | Numeric | 2 + 14 | yes |
| 02 | Number of containers | Numeric | 2 + 14 | yes |
| 10 | Batch Number | Alphanumeric | 2 + 1 to 20 | no |
| 11 | Production Date | Date | 2 + 6 | no |
| 12 | Due date | Date | 2 + 6 | no |
| 13 | Packaging Date | Date | 2 + 6 | no |
| 15 | Sell by Date (Quality Control) | Date | 2 + 6 | no |
| 17 | Expiration Date | Date | 2 + 6 | no |
| 20 | Product Variant | Numeric | 2 + 2 | no |
| 21 | Serial Number | Alphanumeric | 2 + 1 to 20 | no |
| 240 | Additional Product Identification | Alphanumeric | 3 + 1 to 30 | no |
| 241 | Customer part number | Alphanumeric | 3 + 1 to 30 | no |
| 250 | Second Serial Number | Alphanumeric | 3 + 1 to 30 | no |
| 251 | Reference to source entity | Alphanumeric | 3 + 1 to 30 | no |
| 253 | Global Document Type Identifier | Numeric | 3 + 14 to 30 | no |
| 254 | GLN Extension Component | 3 + 1 to 20 | no | |
| 30 | Quantity Each | Numeric | 2 + 1 to 8 | no |
| 310y | Product Net Weight in kg | Numeric | 4 + 6 | no |
| 311y | Product Length/1st Dimension, in meters | Numeric | 4 + 6 | no |
| 312y | Product Width/Diameter/2nd Dimension, in meters | Numeric | 4 + 6 | no |
| 313y | Product Depth/Thickness/3rd Dimension, in meters | Numeric | 4 + 6 | no |
| 314y | Product Area, in square meters | Numeric | 4 + 6 | no |
| 315y | Product Volume, in liters | Numeric | 4 + 6 | no |
| 316y | product Volume, in cubic meters | Numeric | 4 + 6 | no |
| 320y | Product Net Weight, in pounds | Numeric | 4 + 6 | no |
| 321y | Product Length/1st Dimension, in inches | Numeric | 4 + 6 | no |
| 322y | Product Length/1st Dimension, in feet | Numeric | 4 + 6 | no |
| 323y | Product Length/1st Dimension, in yards | Numeric | 4 + 6 | no |
| 324y | Product Width/Diameter/2nd Dimension, in inches | Numeric | 4 + 6 | no |
| 325y | Product Width/Diameter/2nd Dimension, in feet | Numeric | 4 + 6 | no |
| 326y | Product Width/Diameter/2nd Dimension, in yards | Numeric | 4 + 6 | no |
| 327y | Product Depth/Thickness/3rd Dimension, in inches | Numeric | 4 + 6 | no |
| 328y | Product Depth/Thickness/3rd Dimension, in feet | Numeric | 4 + 6 | no |
| 329y | Product Depth/Thickness/3rd Dimension, in yards | Numeric | 4 + 6 | no |
| 330y | Container Gross Weight (Kg) | Numeric | 4 + 6 | no |
| 331y | Container Length/1st Dimension (Meters) | Numeric | 4 + 6 | no |
| 332y | Container Width/Diameter/2nd Dimension (Meters) | Numeric | 4 + 6 | no |
| 333y | Container Depth/Thickness/3rd Dimension (Meters) | Numeric | 4 + 6 | no |
| 334y | Container Area (Square Meters) | Numeric | 4 + 6 | no |
| 335y | Container Gross Volume (Liters) | Numeric | 4 + 6 | no |
| 336y | Container Gross Volume (Cubic Meters) | Numeric | 4 + 6 | no |
| 337y | Kilograms per square meter | Numeric | 4 + 6 | no |
| 340y | Container Gross Weight (Pounds) | Numeric | 4 + 6 | no |
| 341y | Container Length/1st Dimension, in inches | Numeric | 4 + 6 | no |
| 342y | Container Length/1st Dimension, in feet | Numeric | 4 + 6 | no |
| 343y | Container Length/1st Dimension in, in yards | Numeric | 4 + 6 | no |
| 344y | Container Width/Diameter/2nd Dimension, in inches | Numeric | 4 + 6 | no |
| 345y | Container Width/Diameter/2nd Dimension, in feet | Numeric | 4 + 6 | no |
| 346y | Container Width/Diameter/2nd Dimension, in yards | Numeric | 4 + 6 | no |
| 347y | Container Depth/Thickness/Height/3rd Dimension, in inches | Numeric | 4 + 6 | no |
| 348y | Container Depth/Thickness/Height/3rd Dimension, in feet | Numeric | 4 + 6 | no |
| 349y | Container Depth/Thickness/Height/3rd Dimension, in yards | Numeric | 4 + 6 | no |
| 350y | Product Area (Square Inches) | Numeric | 4 + 6 | no |
| 351y | Product Area (Square Feet) | Numeric | 4 + 6 | no |
| 352y | Product Area (Square Yards) | Numeric | 4 + 6 | no |
| 353y | Container Area (Square Inches) | Numeric | 4 + 6 | no |
| 354y | Container Area (Square Feet) | Numeric | 4 + 6 | no |
| 355y | Container Area (Square Yards) | Numeric | 4 + 6 | no |
| 356y | Net Weight (Troy Ounces) | Numeric | 4 + 6 | no |
| 357y | Kilograms per square meter | Numeric | 4 + 6 | no |
| 360y | Product Volume (Quarts) | Numeric | 4 + 6 | no |
| 361y | Product Volume (Gallons) | Numeric | 4 + 6 | no |
| 362y | Container Gross Volume (Quarts) | Numeric | 4 + 6 | no |
| 363y | Container Gross Volume (Gallons) | Numeric | 4 + 6 | no |
| 364y | Product Volume (Cubic Inches) | Numeric | 4 + 6 | no |
| 365y | Product Volume (Cubic Feet) | Numeric | 4 + 6 | no |
| 366y | Product Volume (Cubic Yards) | Numeric | 4 + 6 | no |
| 367y | Container Gross Volume (Cubic Inches) | Numeric | 4 + 6 | no |
| 368y | Container Gross Volume (Cubic Feet) | Numeric | 4 + 6 | no |
| 369y | Container Gross Volume (Cubic Yards) | Numeric | 4 + 6 | no |
| 37 | Number of Units Contained | Numeric | 2 + 1 to 8 | no |
| 390y | Amount payable-single monetary area | Numeric | 4 + 1 to 15 | no |
| 391y | Amount payable with ISO currency code | Numeric | 4 + 4 to 18 | no |
| 392y | Amount payable for a Variable Measure Trade Item single monetary unit | Numeric | 4 + 1 to 15 | no |
| 393y | Amount payable for a Variable Measure Trade Item - with ISO currency code | Numeric | 4 + 4 to 18 | no |
| 400 | Customer Purchase Order Number | Alphanumeric | 3 + 1 to 30 | no |
| 401 | Consignment number | Alphanumeric | 3 + 1 to 30 | no |
| 402 | Shipment Identification Number | Numeric | 3 + 17 | no |
| 403 | Routing code | Alphanumeric | 3 + 1 to 30 | no |
| 410 | Ship To/Deliver To Location Code (EAN13 or DUNS code) | Numeric | 3 + 13 | yes |
| 411 | Bill To/Invoice Location Code (EAN13 or DUNS code) | Numeric | 3 + 13 | yes |
| 412 | Purchase From Location Code (EAN13 or DUNS code) | Numeric | 3 + 13 | yes |
| 413 | Ship for - deliver for - forward to EAN.UCC Global Location Number | Numeric | 3 + 13 | yes |
| 414 | Identification of a physical location EAN.UCC Global Location Number | Numeric | 3 + 13 | yes |
| 415 | EAN.UCC Global Location Number of the invoicing party | Numeric | 3 + 13 | yes |
| 420 | Ship To/Deliver To Postal Code (Single Postal Authority) | Alphanumeric | 3 + 1 to 20 | no |
| 421 | Ship To/Deliver To Postal Code (Multiple Postal Authority) | Alphanumeric | 3 + 4 to 12 | no |
| 422 | Country of origin of a trade item | Numeric | 3 + 3 | no |
| 423 | Country of Initial Processing | Numeric | 3 + 3 to 15 | no |
| 424 | Country of Processing | Numeric | 3 + 3 | no |
| 425 | Country of Disassembly | Numeric | 3 + 3 | no |
| 426 | Country Covering full Process Chain | Numeric | 3 + 3 | no |
| 7001 | NATO Stock Number (NSN) | Numeric | 4 + 13 | no |
| 7002 | UN/ECE Meat Carcasses and Cuts Classification | Alphanumeric | 4 + 1 to 30 | no |
| 7003 | Expiration Date and Time | Numeric | 4 + 10 to | no |
| 7004 | Active Potency | Numeric | 4 + 1 to 4 | no |
| 703s | Approval Number of Processor with ISO Country Code | Alphanumeric | 4 + 3 to 31 | no |
| 8001 | Roll Products - Width/Length/Core Diameter | Numeric | 4 + 14 | no |
| 8002 | Electronic Serial Number (ESN) for Cellular Phone | Alphanumeric | 4 + 1 to 20 | no |
| 8003 | UPC/EAN Number and Serial Number of Returnable Asset | Alphanumeric | 4 + 15 to 30 | no |
| 8004 | UPC/EAN Serial Identification | Alphanumeric | 4 + 1 to 30 | no |
| 8005 | Price per Unit of Measure | Numeric | 4 + 6 | no |
| 8006 | Identification of the component of a trade item | Numeric | 4 + 18 | no |
| 8007 | International Bank Account Number | Alphanumeric | 4 + 1 to 30 | no |
| 8008 | Date and Time of Production | Numeric | 4 + 8 to 12 | no |
| 8018 | EAN.UCC Global Service Relation Number | Numeric | 4 + 18 | no |
| 8020 | Payment Slip Reference Number | Alphanumeric | 4 + 1 to 25 | no |
| 8100 | Coupon Extended Code: Number System and Offer | Numeric | 4 + 6 | no |
| 8101 | 8101 Coupon Extended Code: Number System, Offer, End of Offer | Numeric | 4 + 10 | no |
| 8102 | Coupon Extended Code: Number System preceded by 0 | Numeric | 4 + 2 | no |
| 8110 | Coupon Code Identification for Use in North America | Alphanumeric | 4 + 1 to 30 | no |
| 90 | Mutually Agreed Between Trading Partners | Alphanumeric | 2 + 1 to 30 | no |
| 91 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
| 92 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
| 93 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
| 94 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
| 95 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
| 96 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
| 97 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
| 98 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
| 99 | Internal Company Codes | Alphanumeric | 2 + 1 to 30 | no |
* Date is in the "YYMMDD" format.
This class inherits the BCGBarcode1D class.
Example
BCGdatabarexpanded's Methods
- getLinkageFlag() — Gets if the linkage flag is active
- setLinkageFlag($linkageFlag) — Specifies to use the linkage flag
- setStacked($stackedRow) — Sets the number of desired rows
BCGBarcode1D's Methods
- getThickness() — Returns the thickness of the barcode
- setThickness($thickness) — Specifies the thickness of the barcode
- getLabel() — Gets the label
- setLabel($label) — Sets the label
- getFont() — Gets the text font for the label
- setFont($font) — Sets the text font for the label
- getChecksum() — Gets the checksum appended to the barcode
- setDisplayChecksum($display) — Specifies the checksum to be added to the label
BCGBarcode's Methods
- parse($text) — Analyzes a $text message to draw afterwards
- draw($im) — Draws the barcode on the $im
- getDimension($w, $h) — Returns an array containing the required size for the image
- getScale() — Gets the scale of the barcode
- setScale($x) — Sets the scale of the barcode
- getForegroundColor() — Gets the color of the spaces
- setForegroundColor($color) — Sets the color of the spaces
- getBackgroundColor() — Gets the color of the bars
- setBackgroundColor($color) — Sets the color of the bars
- setColor($fg, $bg) — Sets the color of the bars and spaces
- getOffsetX() — Gets the X offset
- setOffsetX($v) — Sets the X offset
- getOffsetY() — Gets the Y offset
- setOffsetY($v) — Sets the Y offset
- addLabel($label) — Adds a label to the graphic
- removeLabel($label) — Removes a label from the graphic
- clearLabels() — Removes the labels from the graphic
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 DescriptionGets if the linkage flag is active.Returnsbool
-
setLinkageFlag($linkageFlag)
— Specifies to use the linkage flag DescriptionSpecifies 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 DescriptionSets 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 DescriptionThe thickness of the barcode in pixels. The value isn't multiplied by the scale.Returnsint - value in pixels
-
setThickness($thickness)
— Specifies the thickness of the barcode DescriptionThe 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 DescriptionReturns the real value that will be displayed with the barcode. You have to have called the parse() method first.Returnsstring - final label
-
setLabel($label)
— Sets the label DescriptionThe 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 DescriptionGets the text font of the label.ReturnsBCGFontFile, BCGFontPhp or int
-
setFont($font)
— Sets the text font for the label DescriptionThe 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 DescriptionReturns the value that will be appended to the barcode. This method must be called after the method parse().Returnsint - checksum added or false if no checkum is included
-
setDisplayChecksum($display)
— Specifies the checksum to be added to the label DescriptionSetting true will append the checksum to the default label.
The default value is true. -
parse($text)
— Analyzes a $text message to draw afterwards DescriptionThe 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 DescriptionThe 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 DescriptionReturns 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.Returnsarray(int, int) - [0] is the width, [1] is the height -
getScale()
— Gets the scale of the barcode DescriptionGets the scale of the barcode. The value is the number of the "smallest" unit in pixel.Returnsint - value in pixels
-
setScale($x)
— Sets the scale of the barcode DescriptionThe barcode will be $x times bigger. Then a pixel will be $x by $x for its size.
-
getForegroundColor()
— Gets the color of the spaces DescriptionGets the color of the spaces of the barcode.Returns
- setForegroundColor($color) — Sets the color of the spaces
-
getBackgroundColor()
— Gets the color of the bars DescriptionGets the color of the bars of the barcode.Returns
- setBackgroundColor($color) — Sets the color of the bars
-
setColor($fg, $bg)
— Sets the color of the bars and spaces DescriptionAn easy and fast method to set the color of the bars and spaces. Check the setForegroundColor() and setBackgroundColor().
-
getOffsetX()
— Gets the X offset DescriptionGets the X offset of the barcode in pixels. The value isn't multiplied by the scale.Returnsint - value in pixels
-
setOffsetX($v)
— Sets the X offset DescriptionSpecifies 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 DescriptionGets the Y offset of the barcode in pixels. The value isn't multiplied by the scale.Returnsint - value in pixels
-
setOffsetY($v)
— Sets the Y offset DescriptionSpecifies 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 DescriptionAdds a BCGLabel object to the drawing.
-
removeLabel($label)
— Removes a label from the graphic DescriptionRemoves a specific BCGLabel object from the drawing.
-
clearLabels()
— Removes the labels from the graphic DescriptionClears the BCGLabel objects from the drawing.
