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

  1. Start Eclipse and create a new Java project

    Creating a new Java project

todo:image_alt_text

  1. Call the project Demo and click Finish
    We will configure the library later.

    Naming the project

todo:image_alt_text

  1. Right-click on the project we have just created and select required properties

    Setting project properties

todo:image_alt_text

  1. Click on the Java Build Path item and select the Libraries tab

  2. Click Add external Jars

  3. 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

todo:image_alt_text

  1. Right-click on the Demo project and select New and then Class at Package Explorer.

    Creating a new class

todo:image_alt_text

  1. Let this new class be an Applet and name it “Test”

    Setting properties for the new class

todo:image_alt_text

  1. Add the code to generate a PDF417 barcode:
  1. Right-click on this class in the package explorer and select Run As and Java Applet

todo:image_alt_text

  1. 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.