彩票走势图

使用Aspose.BarCode创建自定义宽度条形码

原创|其它|编辑:郝浩|2012-11-23 11:22:11.000|阅读 1454 次

概述:一般来说,条码是通过改变平行线间的宽度和间距代表数据。现在,使用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@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP