How to Read Barcode using Java

This simple example illustrates how to Read Barcode using Java. In Java Barcode reader application can be developed using simple API calls and few coding steps. You can use the example in any Java based application running in Windows, macOS or Linux based operating systems with no dependency on any third party tool or other API.

Steps to Read Barcode using Java

  1. Add Aspose.BarCode for Java from the Maven Repository
  2. Add reference to Aspose.BarCode and Aspose.BarCode.BarCodeRecognition namespaces
  3. Instantiate an object of BarcodeGenerator class and load the Barcode image file
  4. Select the Barcode types using DecodeType enumerator for BarCodeReader
  5. Using Java scan Barcode by looping through information for further usage

The above steps in Java read Barcode from image using few lines of code. We will begin the process by adding API Jar file from Maven repo and including required namespaces. We will then read the source PNG file having single or multiple Barcodes inside that using BarCodeReader instance. We set the desired Barcode types that we are interested in reading by using DecodeType enumerator. In subsequent lines the Barcode reader will extract information from the image and we will iterate that for further usage in our application.

Code to Read Barcode using Java

In the above example, in order to create a Barcode reader Java source code is used in few API calls. The API provides support for reading information from different Barcode types that are specified in DecodeType enumerator including CODABAR, GS1 Code, QR Code, Code 128, Code Matrix and many others. By using few lines of code in Java Barcode scanner has been developed.

In this topic we have explored how easily in Java Barcode scanner example can be developed. If you want information about creating QR codes, refer to the article on how to Generate QR Code using Java.

 English