PNG JPG BMP TIFF SVG
Aspose.BarCode  for C++
GS1 Code 128

Generate GS1 Code 128 Labels with C++

Create GS1 Code 128 barcode in C++ using server-side Aspose.BarCode for C++ API.

How to Generate GS1 Code 128 barcode Using C++

To generate GS1 Code 128 barcode, install Aspose.BarCode for C++ API, a robust and easy-to-use barcode library with rich functionality for C++ platforms. Download the latest version directly from the NuGet package manager: search for Aspose.BarCode.Cpp and then install the package. Alternatively, open the Package Manager console and run the following command:

Command

  PM> Install-Package Aspose.BarCode.Cpp

Steps to Generate GS1 Code 128 barcode in C++

Aspose.BarCode makes it easy for developers to create GS1 Code 128 barcode images with few lines of code.

  • Create an object of BarcodeGenerator class
  • Pass GS1 Code 128 barcode as a parameter
  • Insert input text to encode as the second parameter
  • Define image dimensions if required
  • Call the BarcodeGenerator.Save method to generate and save the GS1 Code 128 barcode barcode

System Requirements

Aspose barcode APIs are supported by all major platforms and operating systems. Before executing the code sample below, please check that you have the following prerequisites enabled in your system.

  • Microsoft Windows, Linux or any OS compatible with C++ Runtime Environment for Windows 32-bit, Windows 64-bit, or Linux 64-bit.
  • Aspose.BarCode for C++ DLL referenced in your project

Code to be executed - C++


// Initialize a BarcodeGenerator class object and Set CodeText & Symbology Type
System::SharedPtr<BarcodeGenerator> generator = [&]
{
    auto tmp_0 = System::MakeObject<BarcodeGenerator>(EncodeTypes::Code128, u"");
    // Set parameters
    tmp_0->get_Parameters()->get_Barcode()->get_XDimension()->set_Millimeters(2);
    tmp_0->get_Parameters()->get_Barcode()->get_CodeTextParameters()->set_Location(Aspose::BarCode::CodeLocation::Below);
    return tmp_0;
}();

// Generate image
System::SharedPtr<System::Drawing::Bitmap> lBmp = generator->GenerateBarCodeImage();
×
Generated barcode image