Working with GS1 Barcode Types in Java

Overview

GS1 is one of the main developers of data processing and encoding standards for barcodes. It is an international non-profit organization that introduces standardized machine data reading methods for item tracking based on the mechanism of automatic identification and data capture (AIDC). GS1 has proposed using application identifiers (AIs) that are defined as identification codes to encode information about items or goods. Such codes serve as prefixes that may be added to barcodes or RFID tags to store some extra information. Moreover, GS1 has introduced special encoding standards for various types.

The barcode types compatible with all GS1 Application Identifiers or the GS1AI_01 type only are listed in the table below.

Compatibility with GS1 AIs

Supported Symbologies

Supports All GS1 AIs DataBar Expanded, DataBar Expanded Stacked, GS1 Codablock-F, GS1 Code 128, GS1 Data Matrix, GS1 QR Code, UPC-A GS1 DataBar Coupon, UPC-A GS1 Code 128 Coupon
Supports Only GS1AI_01 DataBar Omnidirectional, DataBar Stacked Omnidirectional, Databar Limited, DataBar Truncated, DataBar Stacked, EAN 14, ITF 14

GS1 Barcode Generation Standards

Aspose.BarCode for Java supports creating barcodes of various symbologies using formats based on GS1 standards. To generate barcodes in this way, developers first need to pass barcode text through the setCodeText method of class BarcodeGenerator using the following format:

"(Application_Identifier_1)Application_Data(Application_Identifier_2)Application_Data"

As an example, it is possible to set the string “(01)12345678901231(21)ASPOSE(30)9876” as barcode text using the setCodeText method.

GS1 Code 128

GS1 DataMatrix

GS1 UPC-A Coupon Barcodes

In Aspose.BarCode for Java, it is possible to generate UPC-A barcodes with coupon add-ons in the form of DataBar Expanded or GS1 Code128 barcodes displayed nearby the primary barcode label. This can be done also by creating two barcode images separately and then merging them into the same image using special graphic libraries. Aspose.BarCode for Java allows generating barcodes with coupons in a faster and easier manner.

Specifically, Aspose.BarCode for Java enables creating barcodes with coupons using two formats:

  • UPC-A GS1 DataBar Coupon: UPC-A + DataBar Expanded coupon
  • UPC-A GS1 Code 128 Coupon: UPC-A + GS1 Code128 coupon

In Aspose.BarCode for Java, developers can generated aforementioned barcodes with coupons using the EncodeTypes class and fields UPCA_GS_1_CODE_128_COUPON and UPCA_GS_1_DATABAR_COUPON of its subclass SymbologyEncodeType. First, it is needed to call the setCodeText method of class BarcodeGenerator passing barcode text as a string in the special format:

"UPC-A Input Data(Application Identifier)GS1 Barcode Text"

As an example, it is possible to pass the string “123456789012(8110)ASPOSE” to the setCodeText method.

UPC-A + DataBar Expanded

  
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.UPCA_GS_1_DATABAR_COUPON);

// UPCA part is "514141100906", GS1Databar part is "(8110)001234502239811110555"
generator.setCodeText("512345678900(8110)001234502239811110555");

generator.save("UpcaGs1DatabarCoupon.png");

UPC-A + GS1 Code 128

Spacing Settings for Barcodes with Coupons

Aspose.BarCode for Java provides a possibility to modify the size of spacings between primary barcodes and their coupons using the setSupplementSpace method of class CouponParameters.

Following UPC-A GS1 DataBar Coupon barcodes have been created with different spacing settings.

Spacing Size Is Set to 30 Pixels Is Set to 50 Pixels