C++ .H Header File Barcode Font Encoder

The C++ .H Header File is a Barcode Generator for use with Barcode Fonts including QR Code, Data Matrix, DataBar, Code 128, ITF, UPC, EAN, Code 39, and others.The C++ .H Header File is a Barcode Generator for use with Barcode Fonts including QR Code, Data Matrix, Code 128, ITF, UPC, EAN, Code 39, and others.

  • Adds barcode generation capability to C++ apps with a single included .h header file.
  • The method declaration and implementation are in the header file, so no .cpp file is necessary.
  • Supports UTF-8 Unicode for Data Matrix and QR Code.
  • QR Code supports the Swiss QR-Bill with Center OverrideGS1 QR Code, and TLV (Tag-Length-Value) encoding in Base64.
  • Complete unencrypted source code is included with the product.
  • Provided with any Developer License of an applicable font package.

The C++ .H files are provided with all applicable Developer Licenses. To understand implementation or for testing purposes, refer to the example project provided in the Developer Tools file. The header file is a font encoder that formats data to IDAutomation's barcode fonts. It returns a string that when viewed or printed with the applicable barcode font creates a correct barcode symbol.

Implementation is a 2-step process:

Open the downloaded ZIP file and Install the Barcode Font.

Implement the .h header file in your project and add an include statement such as #include "IDAutomationQRCode.h" to the project.

#include "IDAutomationQRCode.h"

Format data from a text string to the font by accessing the function, which is viewable in the top portion of the .h file:

string result = IDAutomation_QRCodeFontEncode(DataToEncode);

When encoding UTF-8 Unicode characters for Data Matrix and QR Code, be sure to include u8 before the string. For example:

DataToEncode = u8"条形码字体";

If issues are experienced, use a process of elimination to identify the problem by comparing the example project with your project. Refer to the top of the .h file to view the function declarations that are supported.

Specific Implementation Examples

Data Matrix

The following is an implementation example that will display the encoded text at the command prompt:

#include <string>
#include <iostream> 
#include "IDAutomationDataMatrix.h"
int main() {
    string DataToEncode = "IDAutomation.com";
    string EncodedData = "";
    int ApplyTilde = 0;
    int EncodingMode = 0;
    int PreferredFormat = 0;
    EncodedData = IDAutomation_DMFontEncode(DataToEncode, ApplyTilde, EncodingMode, PreferredFormat);
    printf("Data Matrix Encoded Data:\n%s\n", EncodedData.c_str());

The function declaration is as follows:
string IDAutomation_DMFontEncode(string DataToEncode, int ApplyTilde, int EncodingMode, int PreferredFormat)


The PDF417 header file is an unobfuscated C++ source code that makes use of character vectors. It was compiled and tested with Visual Studio 2005 and 2008 and does not contain any OS-specific code.

#include <string>
#include <iostream>
#include "PDF417FontEncoder.h"
int main ()
     PDF417FontEncoder PDF;
     long ECL = 3;
     PDF.PDF417Mode = PDF417FontEncoder::PDF417Modes::Binary;

QR Code

Following is a C++ Implementation example of QR Code:

#include <string>
#include <iostream>
#include <math.h>
#include <fstream>
#include "IDAutomationQRCode.h"
int main ()
     QRCodeFontEncoder QR;
     QR.ApplyTilde = true;
     QR.ErrorCorrectionLevel = QR.ECL_M;
     QR.EncodingMode = QR.Enc_Byte;
     QR.Version = QR.V_07;
     QR.DataToEncode = "www.idautomation.com";