Integrating pqScan Barcode Decoder Toolkit into Java project is an easy task. You only need to copy Java barcode reader library from downloaded package to your project folder. Later, directly add this mature library component to your Java classpath. Done! You can load a sample image file that contains Codabar and have a test.
Java Codabar Reading Guide
pqScan Java Barcode Decoder Toolkit allows you to integrate high-end Codabar scanning functions into various Java applications, like Applet, Java Bean, Swing, and J2SE. Superior barcode reading algorithm will be used to scan loaded image file source from four directions which guarantees fast reading speed, as well as Codabar barcode decoding accuracy.
With integration of pqScan Barcode Scanner SDK for Java, you can use various APIs to detect and decode Codabar barcode from raster image files and Java AWT image objects. For example, you can read multiple barcodes in one image and read all barcode types besides Codabar from loaded image source at a time.
To begin with, you may firstly look at available APIs that can be used in Java Codabar barcode scanning application. There're six APIs in the following box that empowers Java programmers to read Codabar only or read all contained barcodes from image file. As you see, these APIs supports reading barcode symbols from three kinds of forms which are image file on your disk, buffered image object, and input stream object.
// Using this API for UPC-E barcode scanning from image file on your disk. public static BarcodeResult[] Scan(String filename, BarCodeType barType); // Using this API for UPC-E barcode scanning from buffered image object. public static BarcodeResult[] Scan(BufferedImage image, BarCodeType barType); // Using this API for UPC-E barcode scanning from input stream object. public static BarcodeResult[] Scan(InputStream imageStream, BarCodeType barType); // Using this API for all barcodes (UPC-E type included) scanning from image file on your disk. public static BarcodeResult[] Scan(String filename); // Using this API for all barcodes (UPC-E type included) scanning from buffered image object. public static BarcodeResult[] Scan(BufferedImage image); // Using this API for all barcodes (UPC-E type included) scanning from input stream object. public static BarcodeResult[] Scan(InputStream imageStream);
This is a simple example of using pqScan Java Barcode Reader Control to decode Codabar 1D barcode(s) only from a Jpg image. If your image file source contains other 1D or 2D barcode symbols besides Codabar, you may use the above later three APIs accordingly. For other barcode symbols reading tutorial, please refer to: Java Barcode Reader SDK - How to Overview.
import com.pqscan.barcodereader.BarcodeResult; import com.pqscan.barcodereader.BarcodeScanner; import com.pqscan.barcodereader.BarCodeType; public class ReadCodabarDemo { public static void main(String[] args) { try { // Specify Codabar to be read from a Jpg sample image. BarcodeResult[] results = BarcodeScanner.Scan("C:/sample.jpg", BarCodeType.Codabar); for(int i = 0; i < results.length; i++) { // Show recognized result. System.out.println(results[i].getData() + "--" + results[i].getBarType()); } } catch (Exception e) { e.printStackTrace(); } } }