Now, you are supported to firstly integrate Java Code 39 Scanner Library into your Java application. In the first place, you may find pqScan.BarcodeReader.jar based on your platform and then copy it to your Java application library folder. Later, please add this Code 39 bar code decoding library to your Java classpath. Finished!
Read Code 39 in Java Project
No matter what barcode generator you use to create 1D Code 39 bar code, like Code 39 barcode font toolkit, as long as it is created under latest barcode specification, our Barcode Scanner Library for Java can easily detect, read and decode Code 39 from image file. In general, image file formats like Jpeg, Png, Bmp, Tiff and Gif are supported. Besides these raster image files, you may also able to recognize barcode from Java AWT image object.
pqScan Java Barcode Reader Library Component is completely developed in Java SDK 1.7, so it can be easily integrate into multiple Java server side environments, such as Servlet, J2EE, JSP, Web Service and so on. After integrated this superior SDK, you can add accurate and fast Code 39 recognition functions into your Java applications, like Applet, Java Bean, J2SE, and Swing.
On this online guide, we will tell Java programmers how to achieve highly accurate Code 39 barcode reading and scanning using well-developed APIs.
The following Java APIs are used for fast Code 39 decoding from image file source. The first group allows you to choose Code 39 as target barcode symbol and direct our Java barcode decoder control to detect and read this barcode type only. And the second one will be used to detecting and decoding all detected bar codes on your loaded image source. This group is very suitable for more than one barcode type recognition.
Java APIs for Scanning Code 39 1D Barcode from Image
// Direct Java Barcode Reader Software to decode Code 39 only from image file at the disk. public static BarcodeResult[] Scan(String filename, BarCodeType barType); // Direct Java Barcode Scanner Software to recognize Code 39 only from BufferedImage object. public static BarcodeResult[] Scan(BufferedImage image, BarCodeType barType); // Direct Java Barcode Decoder Software to scan Code 39 only from InputStream object. public static BarcodeResult[] Scan(InputStream imageStream, BarCodeType barType);
Please note that, our Java Software for Barcode Recognition also supports other 10+ linear and two-dimensional barcode symbols except for Code 39. If you want to decode other barcodes from image source in Java project, please change the barcode type accordingly.
Java APIs for Decoding All Barcodes Detected on Image
// Barcode Reader SDK for Java will read and decode all detected barcode symbols from image at the disk. public static BarcodeResult[] Scan(String filename); // Barcode Decoder SDK for Java will detect and scan all detected barcode symbols from BufferedImage object. public static BarcodeResult[] Scan(BufferedImage image); // Barcode Scanner SDK for Java will scan and recognize all detected barcode symbols from InputStream object. public static BarcodeResult[] Scan(InputStream imageStream);
Here, we provide a simple example to show how you can read Code 39 1D barcode in Java class programming. And the result of detected and recognize Code 39 barcode(s) will be output as data array, which contains both barcode type and barcode data information.
import com.pqscan.barcodereader.BarcodeResult; import com.pqscan.barcodereader.BarcodeScanner; import com.pqscan.barcodereader.BarCodeType; public class ReadCode39Demo { public static void main(String[] args) { try { // Java Barcode Scanner SDK will read Code 39 only from loaded Jpeg image source. BarcodeResult[] results = BarcodeScanner.Scan("C:/sample.jpg", BarCodeType.Code39); for(int i = 0; i < results.length; i++) { // Scanned and decoded Code 39 data characters will be output as array. System.out.println(results[i].getData() + "--" + results[i].getBarType()); } } catch (Exception e) { e.printStackTrace(); } } }