QR Code Image Sample - pqScan.com
Java QR Code Scanner SDK Building up perfect quality QR Code barcode scanning in Java Download Trial Purchase Now

How to Scan QR Code in Java

back to home  >  Java Barcode Scanner SDK  >  How to Read Barcodes in Java  >  Java QR Code Scanner Library

Reading and scanning QR Code 2D barcode from image file is a key feature in pqScan Java Barcode Scanner SDK. Our Java barcode reader library is completely developed in Java SDK 1.7 and complies with various Java Server Side Environments (JSP, Servlet, J2EE and Web Service). Customer can easy integrate advanced QR Code barcode decoding features into Java applications by simply installing downloaded .jar file (see details from the following section).

One thing should be noted here. Our barcode reader component for Java supports reading and recognizing rotated QR Code bar code symbol in Java class programming. That is to say, rotated QR Code on loaded image source can be decoded with high accuracy and fast speed no matter what rotation angle is, like 90, 180, 270 or any certain degree.

Install Java QR Code Scanner to Java Application

All high performance QR Code recognition functions are compiled into a single jar file. You may easily install this professional Java barcode recognition library with two steps as below.

  • Copy pqScan.BarcodeReader.jar to your Java application library folder.
  • Later, add this control library to your Java classpath.

Java QR Code Scanning APIs

By using the following six methods, reading QR Code 2D barcode data information in Java programming class is an easy work. You can quickly load image source into Java application from local file path, image file stream or buffered image object in the memory. More explanation, the first three APIs can be used to decode all barcode symbols from image file if contained and the later ones are capable of recognizing only QR Code bar code symbol if defined.

// Recognize QR Code and other barcode symbols from local image file path.
public static BarcodeResult[] Scan(String filename);
// Scan and read QR Code and other barcode symbols from BufferedImage object in memory.
public static BarcodeResult[] Scan(BufferedImage image);
// Decode and read QR Code and other barcode symbols from InputStream object.
public static BarcodeResult[] Scan(InputStream imageStream);
// Define to read and detect QR Code symbol only from local image file path.
public static BarcodeResult[] Scan(String filename, BarCodeType barType);
// Define to scan and decode QR Code symbol only from BufferedImage object.
public static BarcodeResult[] Scan(BufferedImage image, BarCodeType barType);
// Define to read and recognize QR Code symbol only from InputStream object.
public static BarcodeResult[] Scan(InputStream imageStream, BarCodeType barType);

Recognizing QR Code in Java Class

With the following free Java programming sample code, decoding QR Code barcode message from common raster image file formats and Java AWT image objects is quiet easy. Just three lines of Java class code are needed. Here, raster image file format Jpg is taken as image source on local disk and QR Code is set as the only barcode symbol that will be recognized and output.

import com.pqscan.barcodereader.BarcodeResult;
import com.pqscan.barcodereader.BarcodeScanner;
import com.pqscan.barcodereader.BarCodeType;

public class ReadQRCodeDemo
    public static void main(String[] args)
            // Load image source you need, and select to read QR Code only.
            BarcodeResult[] results = BarcodeScanner.Scan("C:/sample.jpg", BarCodeType.QRCode);

            for(inti = 0; i<results.length; i++)
                // Show all decoded QR Code barcode symbol message
                System.out.println(results[i].getData() + "--" + results[i].getBarType());
        catch (Exception e)
pqScan SDK
Barcode Scanner Tool in Java
Online Guide
Barcode Scanning for Java
Barcode Type
QR Code Scanner in Java Data Matrix Scanner in Java PDF-417 Scanner in Java Aztec Code Scanner in Java EAN-13 Scanner in Java EAN-8 Scanner in Java UPC-A Scanner in Java UPC-E Scanner in Java Code 128 Scanner in Java Code 39 Scanner in Java Code 93 Scanner in Java Codabar Scanner in Java ITF-14 Scanner in Java View All Barcodes >>
I just started using pqScan barcode reader for Java... all I can say is WOW. It makes things easy. I highly recommend you to use this control. Kathy Powell