Barcode Xpress for .NET Core v14.0 - Updated January 7, 2025
Developer Guide / How To / Create a Barcode / Create a 1D Barcode
Create a 1D Barcode

Basic Steps to Create a 1D Barcode

  1. Set the value you want to create:

  2. Call the CreateBitmap method to create a System.Drawing.Bitmap from the BarcodeXpress.writer member:

    • CreateBitmap

    • Create

      There are many additional properties within the Writer class which may be used as needed in creating barcodes. See the class overview for more information.

C# - Basic steps for barcode writing 1D barcodes using Accusoft.BarcodeXpress.NetCore

using (BarcodeXpress bx = new BarcodeXpress("."))
{
    // Set Barcode Type and Value.
    bx.writer.BarcodeValue =  "CODE39";
    bx.writer.BarcodeType = BarcodeType.Code39Barcode;

    // Create a Bitmap with Barcode Xpress.
    using (System.Drawing.Bitmap bitmap = bx.writer.CreateBitmap())
    {
        // Save the created bitmap to a local file.
        bitmap.Save("testfile.bmp");
    }
}

1D barcode values are generally 7-bit ASCII, except for Code 128, which permits the use of 8-bit data. If you are using values above 127, you must use the BarcodeDataAsByte property of the Result class instead of the BarcodeValue property, and your data must be encoded. Also, the reader and writer must both use the same character set.

For writing 1D barcode, Code 128, using ISO-8859-15 encoding

// Register encoding provider.
System.Text.EncodingProvider provider = System.Text.CodePagesEncodingProvider.Instance;
System.Text.Encoding.RegisterProvider(provider);

// Set the required writer properties.
System.Text.Encoding iso = System.Text.Encoding.GetEncoding("ISO-8859-15");
bx.writer.BarcodeData = iso.GetBytes("€27.99");

See Also

Acquire an Image for Barcode Recognition

Recognize a Barcode

Access Results

Barcode Xpress Overview