private static byte[] GenerateCode39Barcode(Code39BarcodeSchema data)
{
BarcodeSettings settings = new BarcodeSettings();
settings.Type = BarCodeType.Code39;
settings.BarHeight = 9;
settings.Data = data.ToString();
settings.ShowText = false;
settings.Rotate = 90;
settings.WideNarrowRatio = 2.4666f;
settings.X = 0.5f;
BarCodeGenerator generator = new BarCodeGenerator(settings);
var image = generator.GenerateImage();
using (MemoryStream stream = new MemoryStream())
{
image.Save(stream, ImageFormat.Png);
var imageBytes = stream.ToArray();
return imageBytes;
}
}