Barcode Generation and Recognition Tutorial
This tutorial explains how to use Aspose.BarCode for Java to generate a PDF417 barcode image and then read a barcode from this image.
In the task considered in this tutorial, we use Eclipse as an IDE, which is free and could be downloaded here: http://www.eclipse.org/downloads/
Barcode Generation
-
Start Eclipse and create a new Java project
Creating a new Java project
-
Call the project Demo and click Finish
We will configure the library later.Naming the project
-
Right-click on the project we have just created and select required properties
Setting project properties
-
Click on the Java Build Path item and select the Libraries tab
-
Click Add external Jars
-
In the opened file dialog, locate Aspose.BarCode.jar and Servlet-api.jar. They are available in the lib directory of the download package of Aspose.BarCode for Java
Adding references
-
Right-click on the Demo project and select New and then Class at Package Explorer.
Creating a new class
-
Let this new class be an Applet and name it “Test”
Setting properties for the new class
- Add the code to generate a PDF417 barcode:
- Right-click on this class in the package explorer and select Run As and Java Applet
- Save the image to a file. Continuing the sample above, add this code to save the generated barcode image to a file:
Barcode Recognition
Continuing the sample above, we can add the code to read a barcode from an image:
The evaluation version of Aspose.BarCode for Java allows decoding only Code 39 barcodes without limitations. To test the reading speed and accuracy for other symbologies, please use the demo JAR provided in the download package.