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.
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.