Read GS1 data from barcode images using Java
Barcode Reader

How to read GS1 data from GS1 barcodes in Java class, Servlet, web, console, J2EE applications?



How to scan, read GS1 barcodes from image using Java?

  1. Download Java Barcode Reader Library
  2. Install Java barcode jar SDK to read GS1 barcode from images in Java web and desktop applications.
  3. Step by Step Tutorial












GS1 data and Barcode Symbologies for GS1 data encoding

The GS1 identification system provides the world a globally unique and unambiguous identification system for physical entities, parties and relationships exchanged in the supply chain.

A GS1 data message includes a list of data element. Each data element is a pair of a GS1 Application Identifier (2 to 4 digits) and its data field.

A GS1 data message could be encoded in independent of data carrier, such as barcode, RFID (radio frequency identification), and business message. The GS1 System has specified the following barcode symbologies to encode GS1 data messages.

  • EAN/UPC symbology
  • ITF-14
  • GS1-128
  • GS1 DataBar
  • GS1 DataMatrix
  • GS1 QR Code
  • GS1 DotCode


OnBarcode Java Barcode Reader library supports reading and decoding all of the above 2d and linear barcode symbologies, except GS1 DotCode.





How to read GS1 data from barcodes in Java class?

The barcode with GS1 data message encoded will include the following information:
  • List of data elements
  • Special characters, such as FNC1

Using Java Barcode Reader library, you do not need to process special characters by yourself. The Java library will automatically handle the characters, and return the list of GS1 data message. Each GS1 Application Identifier will be surrounded by '(' and ')', and followed by its data field.

A sample GS1 data message scanned and returned data message from a barcode using Java barcode reader.
"(01)09012345678901(17)240915(10)abc123(3930)978112"

BarcodeDetail[] result = BarcodeScanner.ScanInDetails(
		"qrcode-gs1-data.png", BarcodeType.QRCode);

for (BarcodeDetail b : result) {
    //  Indicate if the QR Code is conform to GS1 system.
    if (b.isGS1Compitable()) {
        //  Get message in string format.
        //  Eg. "(415)5412345678908(3911)710125"
        String msg = b.getMessage();
        System.out.println("Raw Data: " + b.getData());
        System.out.println("Text Message: " + msg);
        //  Retrieve each AI and its data from the message.
        //  Eg.
        //  AI:   415
        //  Data: 5412345678908
        //  AI:   3911
        //  Data: 710125
        String[] vals = msg.split("[()]");

        for (int i = 0; i < vals.length; i += 2) {
        	System.out.println("AI: " + vals[i]);
        	System.out.println("Data: " + vals[i + 1]);
         }
    }
}












































































Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.