/Decode-Barcode-Image-with-JavaScript-Aspose-Barcode-1

This free consulting project helps you read and decode barcode image using Aspose.BarCode for Java in JavaScript.

Primary LanguageJavaScriptMIT LicenseMIT

This free consulting project will help you in understanding the usage of Aspose.BarCode for Node.js via Java. You can take a picture of a barcode and then display the decoded string in browser.

1. Environment Settings

You need to install Java, Python, Node.js and Formidable to run this sample application. The latest versions are recommended. Follow the below steps to establish the environment:

1.1 Install Java

  • Download the latest Java from the following link:

https://www.oracle.com/java/technologies/javase-jdk15-downloads.html Download Java

  • Install latest version of JAVA SE Development Kit by executing "jdk-15.0.2_windows-x64_bin.exe". (Current Version is 15.0.2).

Install Java

  • Press Yes and proceed with the Wizard with default options. It will install latest JDK as shown below.

Install Java

  • Add or Set the environment variable JAVA_HOME in your operating system as follows:

Install Java

  • Add this value to "path" by adding new entry as shown below:

Install Java

  • Alternatively, you may install Java using npm as follows:
npm I java

1.2 Install Python

  • Download the latest version of Python from the following link:

https://www.python.org/downloads/

Install Java

  • Install Python using python-3.9.2-amd64.exe (Current version is 3.9.2).

Install Java

  • Alternatively you may install Python from npm as follows:
npm i python

1.3 Install Node.js

  • Download the latest version from the following link:

https://nodejs.org/en/download/

Install Java

  • Install the latest version of Node.js using "node-v14.16.0-x64.msi". (Current version is 14.16.0). Following options will be displayed by the Wizard. Select the default options as shown in sequence of images below:

Install Java

Install Java

Install Java

Install Java

Press Next and complete the Node.js installation.

1.4 Install Formidable

Formidable is required to upload file in this application. Use npm to install formidable from the command window as follows:

Install Java

1.5 Use the package to test the application

We have prepared a complete package that contains all the dependencies required to run this application. You just need to install Python, Node.js, Formidable and Java and then follow the steps below to run this application.

  • Create folder "C:\TestFolder"
  • Copy package contents in this folder as follows:

Install Java

Following are the details of contents of this package:

  • sample2.png – This is a sample barcode image that can be used with this sample application.

Install Java

  • lib Folder Contents– This folder contains fileUpload.js file that works as follows:
    • This application will run using http protocol
    • It uses formidable library to upload the image file
    • First a file is loaded and saved in a folder named "Images"
    • This image file is read by AsposeBarCode.Reader and all the barcodes are read from this image and displayed on the web page.
  • fileUpload.js – Application Code

Install Java

  • Node_modules – It contains all the required assemblies to run the aspose.barcode related code and loading the file to browser page.
  • Images – This folder will be used to save the uploaded images
  • Run_file_upload.cmd – This file contains command to run the .js file in lib folder. You may double click it and .js file should be executed as follows:

Install Java

Now open the browser and enter htpp://localhost:8080 that will open a page as follows:

Install Java

- Click on "Choose File" and select the image containing barcoded.
- Press "Submit" once the image is uploaded.
- It will read the image and render the decoded string.

Install Java

1.6 Interested in Aspose free consulting project?

If you are also interested in a free consulting project by Aspose team then please view details on this page

If you have any questions about Aspose APIs, please feel free to post your query in Aspose file format APIs Forums.

Also, you can keep in touch with the latest developments in file format APIs offered by Aspose at our Blog.

1.7 This free consulting project is based on the following issue:

https://github.com/aspose-free-consulting/projects/issues/119