First of all install GenCode128 nuget from nuget package manager and then use the below namespaces and code to generate barcode
using GenCode128;
using System;
using System.Drawing;
using System.IO;
static void Main()
{
Image myimg = Code128Rendering.MakeBarcodeImage("Barcode Value", 2, true);
using (var stream = new MemoryStream())
{
myimg.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
using (var fileStream = File.Create("E:\Barcode.jpeg"))
{
stream.Seek(0, SeekOrigin.Begin);
stream.CopyTo(fileStream);
}
}
}
second parameter in the below code line defines the size of barcode which you can change as per your barcode size requirement.
Image myimg = Code128Rendering.MakeBarcodeImage("Barcode Value", 2, true);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…