原創|其它|編輯:郝浩|2012-11-23 11:22:11.000|閱讀 1496 次
概述:一般來說,條碼是通過改變平行線間的寬度和間距代表數據。現在,使用Aspose.BarCodes可以生成并識別自定義寬度的條形碼。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
一般來說,條碼是通過改變平行線間的寬度和間距代表數據。現在,使用Aspose.BarCode可以生成并識別自定義寬度的條形碼。
創建一個固定的準確條形碼
C#
// Generate the barcode
BarCodeBuilder builder = new BarCodeBuilder();
// Set symbology type
builder.SymbologyType = Symbology.Code128;
// Set the code text
builder.CodeText = "123456";
// Get bitmap with exact barcode only
Bitmap bmp = builder.GetOnlyBarCodeImage();
// Save image on local
bmp.Save("c:\\barcode.png", ImageFormat.Png);
VB.Net
' Generate the barcode
Dim builder As New BarCodeBuilder()
' Set symbology type
builder.SymbologyType = Symbology.Code128
' Set the code text
Dim codetext As String = "123456";
builder.CodeText = codetext
' Get bitmap with exact barcode only
Dim bmp As Bitmap = builder.GetOnlyBarCodeImage()
' Save image on local
bmp.Save("c:\\barcode.png")
創建并為條形碼設置大小
C#
// Generate the barcode BarCodeBuilder builder = new BarCodeBuilder();
// Set symbology type
builder.SymbologyType = Symbology.Pdf417;
// Set the code text
builder.CodeText = "One thing 2 thing";
// Set the code text location
builder.CodeLocation = CodeLocation.None;
// Set graphics unit
builder.GraphicsUnit = GraphicsUnit.Pixel;
// Set margins
builder.Margins.Set(0);
// Get Bitmap with exact barcode only
Bitmap bmp = builder.GetOnlyBarCodeImage();
// Allows to set size for whole picture with barcode inside
Bitmap tt = builder.GetCustomSizeBarCodeImage(new Size(bmp.Width * 5, bmp.Height * 5));
// Save image on local
tt.Save(@"c:\ab\v5.2\test20\barcode2.png", ImageFormat.Png);
VB.NET
' Generate the barcode Dim builder As New BarCodeBuilder()
' Set symbology type
builder.SymbologyType = Symbology.Pdf417
' Set the code text
builder.CodeText = "One thing 2 thing"
' Set the code text location
builder.CodeLocation = CodeLocation.None
' Set graphics unit
builder.GraphicsUnit = GraphicsUnit.Pixel
' Set margins
builder.Margins.[Set](0)
' Get Bitmap with exact barcode only
Dim bmp As Bitmap = builder.GetOnlyBarCodeImage()
' Allows to set size for whole picture with barcode inside
Dim tt As Bitmap = builder.GetCustomSizeBarCodeImage(New Size(bmp.Width * 5, bmp.Height * 5))
' Save image on local
tt.Save("c:\ab\v5.2\test20\barcode2.png", ImageFormat.Png)
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉載自:慧都控件網