Barcode Xpress for .NET Core v13.9 - Updated
Create a 1D Barcode
Developer Guide > How To > Create a Barcode > Create a 1D Barcode

Basic Steps to Create a 1D Barcode

  1. Set the value you want to create:

    Property Description
    BarcodeType Gets and sets the type of barcode to create from the BarcodeType enumeration.
    BarcodeValue Gets and sets the value of the barcode to be created.
    BarcodeData Gets and sets the current barcode value as an array of bytes used only if non-ASCII text values are needed.
  2. Call the CreateBitmap method to create a System.Drawing.Bitmap from the BarcodeXpress.writer member: 

    Method Description
    CreateBitmap Creates Bitmap barcodes.
    Create Creates a DIB (Device Independent Bitmap).

    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

Is this page helpful?
Yes No
Thanks for your feedback.