We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Simple recognition code doesn't work

Hello,

I’m trying to evaluate Aspose barcode product. I’ve downloaded the version 17.7 of the library.
I would want to create a barcode in a first step.
In a second step, I want to decode it.

Here is my code:
import com.aspose.barcode.BarCodeBuilder;
import com.aspose.barcode.Symbology;
import com.aspose.barcode.barcoderecognition.BarCodeReadType;
import com.aspose.barcode.barcoderecognition.BarCodeReader;

public class ReadBarCode {

private static String strBaseFolder = "/Users/tom/Documents/workspacejuno/Demo/";

/**
 * @param args
 */
public static void main(String[] args) {
    try
    {
    	String strImageFile = "barcode.jpg";
    	String strCodeText = "test-code39";
    	BarCodeBuilder b = new BarCodeBuilder(strCodeText, Symbology.Code39Standard);
    	b.save(strBaseFolder+strImageFile);
    	System.out.println("Barcode saved successfully!");
    	
    	BarCodeReader reader = new BarCodeReader(strBaseFolder+strImageFile, BarCodeReadType.Code39Standard);
    	while (reader.read()) {
			System.out.println("Codetext found:"+reader.getCodeText());
		}
    	reader.close();
    }
    catch (Exception ex) { 
    	System.out.println(ex.getMessage());
    }
}

}

The creation of the barcode is ok but I can’t decode it. Here is the console output:

Barcode saved successfully!
Sorry, evaluation version only allows Code39 recognition
 Please set BarCodeReader's BarCodeReadType property to Code39Standard.

Can you please indicate me what I’m doing wrong.
Thank you.

@thenrion,

The message shows that you are not setting the license before accessing any functionality of the barcode API. Evaluation version has some limitations due to which you are unable to recognize the barcode. Please set the license before accessing any functionality of the API. In case you do not have the license and you want to try Aspose.BarCode without evaluation version limitations, you can also request a 30-day temporary license. Please refer to How to get a Temporary License? for more information.

Code to set the license is given below for your reference:

com.aspose.barcode.License license = new com.aspose.barcode.License();
license.setLicense("lic\\Aspose.BarCode.lic");

Thank you for your help.
How can I get the file Aspose.BarCode.lic?

@thenrion,

You have to purchase this license file. For purchase you may post your inquiry on Aspose.Purchase forum. You can also request a 30-day temporary license for evluation purpose without any cost. Please refer to How to get a Temporary License? for more information.

Hello ikram,

Do you confirm that an unlimited evaluation (free) licence with restricted functionalities (ep. barcode limited to Code39Standard type) is not suited for the use case described in my first post?

@thenrion,

The evaluation/temporary license is free. It is just like the regular license without any restriction and limitation. You can access/use any API and evaluate it. The only difference is that it will expire after 30 days.

Thank you Ikram, I wanted to do a pre test before submitting for a 30 days evaluation period.
If it’s not possible I will ask for the temporary licence.

@thenrion,

Thank you for update. Sure, you can ask for the temp license any time.