Itextsharp'da barkod image yaratmanız için yazmış olduğum method...
Reference lardan System.Drawing'i eklemeyi unutmayın...
public static Image CreateBarcodeImage(string barcodeText)
{
Barcode39 code39 = new Barcode39();
code39.BarHeight = 5;
code39.Code = barcodeText;
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(code39.CreateDrawingImage(System.Drawing.Color.Black, System.Drawing.Color.White));
MemoryStream ms = new MemoryStream();
bm.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
Image img = iTextSharp.text.Image.GetInstance(ms.ToArray());
return img;
}
{
Barcode39 code39 = new Barcode39();
code39.BarHeight = 5;
code39.Code = barcodeText;
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(code39.CreateDrawingImage(System.Drawing.Color.Black, System.Drawing.Color.White));
MemoryStream ms = new MemoryStream();
bm.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
Image img = iTextSharp.text.Image.GetInstance(ms.ToArray());
return img;
}
Hiç yorum yok:
Yorum Gönder