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

How to Read Data Matrix Using Java

back to home  >  Java Barcode Scanner SDK  >  How to Read Barcodes in Java  >  Java Data Matrix Reader Library

This is an online tutorial page for how to scan Data Matrix in Java application. Well-designed APIs and free Java programming demo are illustrated. To begin with, you may download free trial of pqScan Java Barcode Scanner SDK via download button above. And then install it into your application.

Start to Install Java Data Matrix Scanner

After integrating Java barcode reader library pqScan.BarcodeReader.jar into your project, you can implement high speed Data Matrix reading and scanning from many image file source, like Jpeg, Bmp, Tiff, Png, Gif raster image formats and Java AWT image objects. Installation steps are simple. First step is to copy downloaded jar file to Java application library folder. And the second is to add this jar file to Java classpath.

In addition to 2D barcode symbol Data Matrix, our Java library component for barcode scanning also supports other bar code symbols, like Aztec Code, QR Code, PDF417 and eight linear barcode types. You may see online guide for each Java barcode reading through the right menu bar.

Choose Suitable Java Programming APIs

Six professional APIs are well developed in Java SDK 1.7. By using these methods, programmers are empowered to achieve highly accurate 2D Data Matrix detecting and decoding. Our barcode reader software for Java supports reading Data Matrix bar code information from image file path, BuffereImage object and InputStream object. Please see detailed explanations for supportive scanning APIs below.

APIs for Choosing Data Matrix to Read

// APIs for scanning and detecting Data Matrix only from local image file.
public static BarcodeResult[] Scan(String filename, BarCodeType barType);
// APIs for reading and detecting Data Matrix only from BufferedImage object.
public static BarcodeResult[] Scan(BufferedImage image, BarCodeType barType);
// APIs for scanning and recognizing Data Matrix only from InputStream object.
public static BarcodeResult[] Scan(InputStream imageStream, BarCodeType barType);

APIs for Allowing All Barcode Symbologies Recognition

// APIs for scanning and decoding Data Matrix and other contained symbols from image file on disk.
public static BarcodeResult[] Scan(String filename);
// APIs for reading and decoding Data Matrix and other contained symbols from BufferedImage object.
public static BarcodeResult[] Scan(BufferedImage image);
// APIs for reading and recognizing Data Matrix and other contained symbols from the InputStream object.
public static BarcodeResult[] Scan(InputStream imageStream);

Have a Try with Java Class Code

The following Java class sample code shows how to read and scan Data Matrix bar code data information from a local Jpg image file and output its decoded result which contains both recognized barcode type and barcode data information.

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

public class ReadDataMatrixDemo
    public static void main(String[] args)
            // Customize Data Matrix as the only bar code symbology to be detected and recognized.
            BarcodeResult[] results = BarcodeScanner.Scan("C:/sample.jpg", BarCodeType.DataMatrix);

            for(int i = 0; i < results.length; i++)
                // Show all recognized information.
                System.out.println(results[i].getData() + "--" + results[i].getBarType());
        catch (Exception e)

If there are other barcode symbols on your loaded image source in Java program, you are supposed to use the later three APIs to allow all bar codes recognition.

pqScan SDK
Java Barcode Decoder SDK
Online Guide
Java Barcode Reading Tutorial
Barcode Type
Java Tutorial: Scan QR Code Java Tutorial: Scan Data Matrix Java Tutorial: Scan PDF-417 Java Tutorial: Scan Aztec Code Java Tutorial: Scan EAN-13 Java Tutorial: Scan EAN-8 Java Tutorial: Scan UPC-A Java Tutorial: Scan UPC-E Java Tutorial: Scan Code 128 Java Tutorial: Scan Code 39 Java Tutorial: Scan Code 93 Java Tutorial: Scan Codabar Java Tutorial: Scan ITF-14 View All Barcodes >>
I have been a customer of pqScan for almost one year now and love its barcode scanner product. Your timely support service is efficient and helpful. Felipe Graver