Multiple 1D bar code symbologies can be scanned and decoded from image file by Barcode Scanning Control for Java, like UPC-A, UPC-E, EAN-13, EAN-8, Codabar, Code 128, Code 93, Code 39, and ITF-14. This professional barcode reading software in Java supports JDK 1.7 and above versions. Fast barcode reading and scanning features are well developed into a jar file.
On this online guide, we will concentrate on Java UPC-A 1D barcode recognition and decoding. UPC-A barcode symbology encodes 12 data characters (0-9, and start/stop characters) including checksum digit. So, the bar code decoding result will includes 12 data characters. And the last data would be its checksum digit. Please note that, the first decoded data will be a "?" character if you are using the free trial package of Java Barcode Scanner Library.
Java UPC-A Reader Installation
To begin with, users are supposed to install Java Barcode Reader Software into your own Java application. And this is quiet easy. Only two steps are required.
- Copy pqScan Java Barcode Scanner SDK jar file to your Java project library folder.
- Add pqScan Java Barcode Scanner SDK jar to your Java classpath.
Java UPC-A Scanning APIs
pqScan Java Barcode Scanner Component empowers Java programmers to read and recognize UPC-A from various image file formats with advanced APIs, like BMP, JPEG, PNG, TIFF and GIF. Besides, BufferedImage and InputStream are also supported. Please see detailed introductions for all feasible APIs.
// Fast barcode scanning and reading from local image file in Java class.
public static BarcodeResult Scan(String filename);
// Fast barcode recognition from BufferedImage object in Java class.
public static BarcodeResult Scan(BufferedImage image);
// Fast barcode detecting and reading from InputStream object in Java class.
public static BarcodeResult Scan(InputStream imageStream);
// Recognizing UPCA only from local image file in Java class.
public static BarcodeResult Scan(String filename, BarCodeType barType);
// Decoding UPCA only from from BufferedImage object in Java class.
public static BarcodeResult Scan(BufferedImage image, BarCodeType barType);
// Scanning UPCA only from InputStream object in Java class.
public static BarcodeResult Scan(InputStream imageStream, BarCodeType barType);
Java UPC-A Recognition Sample Code
Please see the following ReadUPCADemo class. Only a few lines of Java programming code can do fast and accurate UPC-A barcode detecting and decoding in Java application. This free demo will only read UPC-A linear bar code font from loaded image file source. If you want to decode other barcodes contained in the image, please use the first three APIs above.
public class ReadUPCADemo
public static void main(String args)
// Recognize UPCA barcode only from image file source.
BarcodeResult results = BarcodeScanner.Scan("C:/sample.jpg", BarCodeType.UPCA);
for(int i = 0; i < results.length; i++)
// Output recognized UPCA data characters.
System.out.println(results[i].getData() + "--" + results[i].getBarType());
catch (Exception e)