(zxing.net)一维码ITF的简介、实现与解码

一、简介

一维码ITF 25又称交插25条码,常用在序号,外箱编号等应用。交插25码是一种条和空都表示信息的条码,交插25码有两种单元宽度,每一个条码字符由五个单元组成,其中二个宽单元,三个窄单元。在一个交插25码符号中,组成条码符号的字符个数为偶数,当字符是奇数个时,应在左侧补0变为偶数。条码字符从左到右,奇数位置字符用条表示,偶数位字符用空表示。交插25码的字符集包括数字0到9.
二、实现

    public ActionResult ITF()
    {
        EncodingOptions options = new EncodingOptions();
        options.PureBarcode = false;
        options.GS1Format = false;
        options.Width = 160;
        options.Height = 75;
        options.Margin = 10;

        BarcodeWriter writer = new BarcodeWriter();
        writer.Format = BarcodeFormat.ITF;
        writer.Options = options;

        //如需设置图片为其它颜色,使用此段代码
        //BitmapRenderer renderer = new BitmapRenderer();
        //renderer.Foreground = Color.Black;
        //renderer.Background = Color.White;
        //writer.Renderer = renderer;

        Bitmap bmp = writer.Write("10614141999993");
        MemoryStream ms = new MemoryStream();
        bmp.Save(ms, ImageFormat.Png);
        ms.Flush();
        ms.Position = 0;
        return File(ms, "application/x-png");
    }

测试图像如下:

   

三、解码

点击查看

原文地址:https://www.cnblogs.com/weiweixiang/p/10076997.html