Spire.barcode for Java support generates a variety of one-dimensional, two-dimensional barcodes, such as code 128,pdf 417 and QR code, and it also supports the recognition of these barcodes from the picture. The previous article-spire.barcode the for Java component (i) to generate barcodes, two-dimensional codes (QR Code,code 128,ean 13, etc.), has described how to use this article to describe how to use Spire.barcode for Java to generate barcodes. This article will describe how to Spire.barcode for Java to identify barcodes.
The following figure is a code 128 barcode Picture:
Before you can use the following code, you need to download Spire.barcode for Java and then import the Spire.Barcode.jar file into your project.
Import Com.spire.barcode.BarCodeType;
Import Com.spire.barcode.BarcodeScanner;
public class scan_barcode{public
static void Main (string[] args) throws Exception {
///using the Scan method to identify code 128 code from the picture
string[] datas = Barcodescanner.scan ("c:\\code128.jpg", barcodetype.code_128);
System.out.print (Datas[0]);
}
Identification results: