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.
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:
- Download the latest Java from the following link:
https://www.oracle.com/java/technologies/javase-jdk15-downloads.html
- Install latest version of JAVA SE Development Kit by executing "jdk-15.0.2_windows-x64_bin.exe". (Current Version is 15.0.2).
- Press Yes and proceed with the Wizard with default options. It will install latest JDK as shown below.
- Add or Set the environment variable JAVA_HOME in your operating system as follows:
- Add this value to "path" by adding new entry as shown below:
- Alternatively, you may install Java using npm as follows:
npm I java
- Download the latest version of Python from the following link:
https://www.python.org/downloads/
- Install Python using python-3.9.2-amd64.exe (Current version is 3.9.2).
- Alternatively you may install Python from npm as follows:
npm i python
- Download the latest version from the following link:
https://nodejs.org/en/download/
- 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:
Press Next and complete the Node.js installation.
Formidable is required to upload file in this application. Use npm to install formidable from the command window as follows:
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:
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.
- 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
- 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:
Now open the browser and enter htpp://localhost:8080 that will open a page as follows:
- 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.
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.
https://github.com/aspose-free-consulting/projects/issues/119