|
DataSymbol Barcode Reader SDK Technical Questions |
Technical questions
A barcode was not decoded. Why?
My file contains several barcodes, but only one barcode was decoded. Why did it happen?
How to use your Barcode Reader SDK in Java application?
Our barcode reading engine uses various methods to achieve maximum recognition. But sometimes it is impossible to decode a barcode due to its poor quality. Send us this image, it may help us improve our software.
First of all, check whether you use the standard or professional edition. The standard edition decodes only one barcode in a file.
If you use the professional edition, check how the LinearFindBarcodes property is set. By default, this property is set to 1, i.e. only one barcode is decoded in a file. For example, if you want to decode up to 5 barcodes, set this property to 5.
To use Barcode Reader ActiveX in a Java application, you need to use special software to connect COM and Java – for instance, JACOB.
This combination will only work on a Windows machine. Below is an example of a Java application that calls the methods of our barcode decoding SDK.
[Java]
import com.jacob.com.*;
import com.jacob.activeX.*;
public class BarcodeReader
{
public static void main(String args[])
{
System.out.println("\nUsing www.DataSymbol.com Barcode Reader SDK in Java\n");
try
{
ActiveXComponent barcodeDecoder = new ActiveXComponent("BarcodeReader.BarcodeDecoder");
barcodeDecoder.setProperty("LinearFindBarcodes", new Variant(7));
int cBarcodes = Dispatch.call(barcodeDecoder, "DecodeFile",
new Variant("c:\\barcodes.jpg")).getInt();
System.out.println("Decoded barcodes: " + cBarcodes + "\n");
if (cBarcodes != 0)
{
int i;
Dispatch barcodeList = barcodeDecoder.getProperty("Barcodes").toDispatch();
for (i = 0; i < cBarcodes; ++i)
{
Dispatch barcode = Dispatch.call(barcodeList, "item", new Variant(i)).toDispatch();
System.out.println( Dispatch.get(barcode, "Text").getString() );
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
ComThread.Release();
}
}
}
|