ByteScout BarCode Generator SDK - C++ - Generate Barcode - ByteScout

ByteScout BarCode Generator SDK – C++ – Generate Barcode

  • Home
  • /
  • Articles
  • /
  • ByteScout BarCode Generator SDK – C++ – Generate Barcode

How to generate barcode in C++ with ByteScout Barcode SDK

This tutorial will show how to generate barcode in C++

We made thousands of pre-made source code pieces for easy implementation in your own programming projects. ByteScout Barcode SDK is the robost library (Software Development Kit) that is designed for automatic generation of high-quality barcodes for printing, electronic documents and pdf. All popular barcode types are supported from Code 39 and Code 129 to QR Code, UPC, GS1, GS-128, Datamatrix, PDF417, Maxicode and many others. Provides support for full customization of fonts, colors, output and printing sizes. Special tools are included to verify output quality and printing quality. Can add generated barcode into new or existing documents, images and PDF. It can generate barcode in C++.

You will save a lot of time on writing and testing code as you may just take the C++ code from ByteScout Barcode SDK for generate barcode below and use it in your application. Follow the instructions from the scratch to work and copy the C++ code. Detailed tutorials and documentation are available along with installed ByteScout Barcode SDK if you’d like to dive deeper into the topic and the details of the API.

You can download free trial version of ByteScout Barcode SDK from our website to see and try many others source code samples for C++.

Try it today: Get 60 Day Free Trial or sign up for Web API

BarcodeGenerationExample.cpp
      
#include "stdafx.h" #import "Bytescout.BarCode.tlb" raw_interfaces_only using namespace Bytescout_BarCode; int _tmain(int argc, _TCHAR* argv[]) { // Initialize COM. HRESULT hr = CoInitialize(NULL); // Create the interface pointer. IBarcodePtr pIBarcode(__uuidof(Barcode)); // set the registration name and key BSTR regname = ::SysAllocString(L"DEMO"); pIBarcode->put_RegistrationName(regname); ::SysFreeString(regname); BSTR regkey = ::SysAllocString(L"DEMO"); pIBarcode->put_RegistrationKey(regkey); ::SysFreeString(regkey); // Set barcode type (symbology) pIBarcode->put_Symbology(SymbologyType_Code128); // Set barcode value BSTR value = ::SysAllocString(L"Abc123"); pIBarcode->put_Value(value); ::SysFreeString(value); // Save barcode image BSTR fileName = ::SysAllocString(L"result.png"); pIBarcode->SaveImage(fileName); ::SysFreeString(fileName); pIBarcode->Release(); // Uninitialize COM. CoUninitialize(); return 0; }

Try it today: Get 60 Day Free Trial or sign up for Web API

BarcodeGenerationExample.sln
      
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BarcodeGenerationExample", "BarcodeGenerationExample.vcxproj", "{7197580A-6CCC-4581-BD61-9028B6A0578E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7197580A-6CCC-4581-BD61-9028B6A0578E}.Debug|Win32.ActiveCfg = Debug|Win32 {7197580A-6CCC-4581-BD61-9028B6A0578E}.Debug|Win32.Build.0 = Debug|Win32 {7197580A-6CCC-4581-BD61-9028B6A0578E}.Release|Win32.ActiveCfg = Release|Win32 {7197580A-6CCC-4581-BD61-9028B6A0578E}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal

Try it today: Get 60 Day Free Trial or sign up for Web API

stdafx.cpp
      
// stdafx.cpp : source file that includes just the standard includes // BarcodeGenerationExample.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file

Try it today: Get 60 Day Free Trial or sign up for Web API

stdafx.h
      
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> // TODO: reference additional headers your program requires here

Try it today: Get 60 Day Free Trial or sign up for Web API

targetver.h
      
#pragma once // Including SDKDDKVer.h defines the highest available Windows platform. // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. #include <SDKDDKVer.h>

Try it today: Get 60 Day Free Trial or sign up for Web API

MORE INFORMATION

Get 60 Day Free Trial or Visit ByteScout Barcode SDK page

Explore ByteScout Barcode SDK documentation

WEB API VERSION

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next