Java Barcode Reader SDK is a Java barcode reading and scanning library which scan, read and parse 1D and 2D barcodes from image files.
Besides Java Barcode Reader library, KeepAutomation also provides
Java Barcode Generator for creating, encoding barcodes in the Java application.
In this article, you will learn how to start reading barcodes in your Java program. How to use advanced scanning options to read barcodes, and get detailed barcode information.
Requirement
JDK 1.4.2 or later
Install
Add com.keepautomation.barcodereader.jar to your Java project classpath.
Limits using the trial version
There is only one limit using the trial version of Java Barcode Reader library.
The first barcode character returned is randomly generated.
- QR Code
- PDF 417
- Data Matrix
- Codabar
- Code39
- Code39Ex
- Code128
- EAN8
- EAN13
- Interleaved25
- UPCA
- UPCE
How to reading barcodes in Java program?
You can read the Java demo source code below. It is really easy to read barcodes in your Java program. Use method
BarcodeReader.readBarcodeMessage() with input barcode image file, and target barcode type, you will get the all barcodes
from the image file in your Java application.
import com.keepautomation.barcodereader.BarcodeReader;
import com.keepautomation.barcodereader.BarcodeType;
…
String[] msgs = BarcodeReader.readBarcodeMessage("C:/Sample.png", BarcodeType.Code128);
…
How to scan barcodes from specified area in the barcode image file in Java program?
To improve image scanning speed, you can specify a rectangle region, and the Java barcode reader library will scan barcodes from the specified region
in the image file in your Java application.
import com.keepautomation.barcodereader.BarcodeReader;
import com.keepautomation.barcodereader.BarcodeType;
import com.keepautomation.barcodereader.Region;
import java.util.ArrayList;
…
ArrayList<Region> regions = new ArrayList<Region>();
// xMin: Minimum X of the scan area, in % of the image width.
// xMax: Maximum X of the scan area, in % of the image width.
// yMin: Mimimum Y of the scan area, in % of the image height.
// yMax: Maximum Y of the scan area, in % of the image height.
regions.add(new Region(0F, 100F, 0F, 20F));
String[] msgs = BarcodeReader.readBarcodeMessage("C:/Sample.png", BarcodeType.Code128, regions);
…
Pass your barcode image file, and barcode type, and list of region areas, the barcode reader library will return all barcodes found in the areas inside the image file using Java program.
How to read barcodes from TIFF image files in Java?
For TIFF image files reading only, Java developers need include two Java Advanced Imaging jars from Sun Microsystems, jai_codec.jar, jai_core.jar.
For more information, please view
Java Advanced Imaging
For multi-page tiff files, Java barcode reader will process and scan all pages in the tiff file, and return all barcodes found.
How to read supplement barcode data using Java?
Barcode type EAN-8, EAN-13, UPC-A, UPC-E, ISBN, ISSN, their barcode may include 2 or 5 digits supplemental barcode.
Java Barcode Reader will return the barcode data with supplemental barcode data in the end.