This simple example illustrates how to Read Barcode using C++. In order to develop a Barcode reader C++ source code is used inside any of C++ supported application in MS Windows by following few coding steps. We will see how we can read different Barcode types simultaneously from a single file with no dependency on any third party tool or other API.
Steps to Read Barcode using C++
- Add Aspose.BarCode for C++ API using NuGet package manager in your application
- Include a reference to Aspose::BarCode and Aspose::BarCode::BarCodeRecognition namespaces
- Add the required header files references in your application
- Use the BaseDecodeType array to set the desired Barcode types to read from source file
- Initialize BarCodeReader class object to read the Barcodes from PNG file
- Iterate through extracted Barcode information and display that in console
In C++ Barcode scanner application can be developed by adhering to afore mentioned steps and few lines of code. Firstly, you will be required to add the API reference using NugGet and including required header files. In next step, you will set the desired Barcode types for which you to develop a reader by using DecodeType enumerator. By using BarCodeReader class instance, we will provide the path for source PNG file having different Barcodes and desired Barcode types array. Finally, we will iterate through the read Barcode information and will display that in console.
Code to Read Barcode using Java
In the above example, in order to create a Barcode reader C++ based application has been developed using few lines of easy to understand code which is capable of scanning different Barcode types. In this application, we have focused on developing a Barcode reader for QR, Code 39 Standard, Pdf 417, Data Matrix, Code 128 and RM 4 SCC types. But API supports many other Barcode types that you can explore in DecodeType enumerator. We have used simple API calls to develop a C++ Barcode reading application.
In this example, we have explored that in order to develop a Barcode Scanner C++ based API and its respective features can be used. If you are interested in generating QR code, refer to the article on how to Generate QR Code using C++.