A QR code is kind of a barcode that can be read by a machine. It is an optical label used to recognize objects or disseminate some information. In some use cases, you might need to scan a QR code. In accordance with such scenarios, this article explains how to scan a QR code programmatically in Java.
- Java API Configuration to Scan or Recognize QR Barcode
- Scan QR Code in Java
- Scan QR Code from a Stream in Java
Java API Configuration to Scan or Recognize QR Barcode
You can easily acces the Aspose.BarCode for Java API to process different kinds of barcodes including the QR Codes. Quickly install the API by downloading its JAR files the New Releases section or use the following Maven configurations in the pom.xml file of your application.
<name>Aspose Java API</name>
Scan QR Code in Java
You need to folow the steps below to scan a QR Code:
- Create an instance of the BarCodeReader class and specify the DecodeType value.
- Instantiate an object of BarCodeResult class.
- Scan the QR Code and get output text.
The code snippet below explains how to scan a QR Code in Java:
Scan QR Code from a Stream in Java
The following are the steps to read a QR code from a Stream in Java:
- Load the input file from a Stream and initiate an object of the BarcodeReader class.
- Set the DecodeType property to QR and create an instance of BarCodeResult class.
- Scan the QR Code and print scanned result.
The following code snippet elaborates how to scan a QR code from a stream programmatically in Java:
Get a Free License
You may request a free temporary license to evaluate the API without any restrictions.
In this article, you have leanred how to scan a QR Code programmatically in Java. Furthermore, please visit the documentation section if you are interested to explore various other capabilities and features of the API. In case you need to discuss any of your concerns, please feel free to write to us at the forum.