- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Java Barcode Reader Developer GuideHow to Scan & Read Linear & 2D BarCodes in Java applications using Java Barcode Reader LibraryJava Barcode Reader is a Java barcode scanning library which scan and read 1D (linear) and 2D (matrix) barcodes from image files. Besides Java Barcode Reader library, OnBarcode also provides Java Barcode Generator for generating linear and 2D barcodes in the Java program. This article provides detailed developer guide for Java Barcode Reader library. To use this article, you need first download the trial version of Java Barcode Reader from our site. Index
Java Barcode Reader Package Overview
Java Barcode Reader Install & RequirementRequirementYou need Java JDK 1.4.2 or later version. Install
Put BarcodeReader.jar into your Java project classpath. How to read barcodes using Java Barcode Reader?
Read barcodes from image is a simple task with barcode reader for java library.
String[] datas = BarcodeReader.read(new File("C:/YourBarcodeImage.gif"), BarcodeReader.EAN8);
Pass your barcode image file, and barcode type to BarcodeReader, and it will return barcode datas. Complete demo source code is under test-src folder. Java Barcode Reader FAQHow to read barcode from a specified area (rectangle) in the image?
To improve scanning speed, you can specify a rectangle area in the image for scanning barcode.
ScanOption option = new ScanOption();
/**
* specify barcode area in the scanning image
*
* x1, y1, x2, y2, valid values are from 0 to 1, inclusive.
*
* @param x1 barcode area left top point X value, % of image width
* @param y1 barcode area left top point Y value, % of image height
* @param x2 barcode area right bottom point X value, % of image width
* @param y2 barcode area right bottom point Y value, % of image height
*/
// scan top 20% of the image
option.setScanDirection(ScanOption.SCAN_FROM_TOP_TO_BOTTOM);
option.setBarcodeArea(0, 0, 1, 0.2);
String[] datas = BarcodeReader.read(new File("C:/YourBarcodeImage.gif"), BarcodeReader.EAN8, option);
How to get supplement barcode data?
Java Barcode Reader Supporting Bar Code Symbology Types
|