How to create Code39 barcodes in C#

2017-06-12 07:45:38 Written by  support iceblue
Rate this item
(0 votes)

Code39 is also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, USD-3. This article will show you how to use Spire.Barcode to create Code39 barcode. It supports 43 characters, consisting of uppercase letters (A through Z), numeric digits (0 through 9) and a number of special characters (*, -, $, /, +, %, and space). Usually Code39 starts and ends with “*”. Here comes to the steps of how to create Code39 barcodes.

Step 1: Create a BarcodeSettings instance.

BarcodeSettings bs = new BarcodeSettings();

Step 2: Set the BarcodeType property to Code39

bs.Type = BarCodeType.Code39;

Step 3: Set the data for the barcode.

bs.Data = "*ABC 12345* ";

Step 4: Generate barcode image using BarCodeGenerator.

BarCodeGenerator bg = new BarCodeGenerator(bs);
bg.GenerateImage().Save("Code39Code.png");    

Effective screenshot of Code39 barcode image:

How to create Code39 barcodes in C#

Full codes:

using Spire.Barcode;


namespace Code39
{
    class Program
    {
        static void Main(string[] args)
        {
            BarcodeSettings bs = new BarcodeSettings();

            bs.Type = BarCodeType.Code39;
            bs.Data = "*ABC 12345* ";


            BarCodeGenerator bg = new BarCodeGenerator(bs);

            bg.GenerateImage().Save("Code39Code.png");
            System.Diagnostics.Process.Start("Code39Code.png");
        }
    }
}

Additional Info

  • tutorial_title: Create Code39 barcodes in C#
Last modified on Wednesday, 15 September 2021 03:29