【问题标题】:ZXing <FNC> Separator for GS1 bar codeZXing <FNC> GS1 条码分隔符
【发布时间】:2017-05-24 18:57:51
【问题描述】:

我试图在我的 ZXing 条形码中放置 &lt;FNC1&gt; 分隔符,我不确定这些应该如何格式化为字符串值。我有

BarcodeWriterPixelData writer = new BarcodeWriterPixelData()
{
    Format = BarcodeFormat.CODE_128,
    Options = new ZXing.Common.EncodingOptions
    {
        Width = 554,
        Height = 120
    }
};
var pixelData = writer.Write("<FNC1>42011111<FNC1>92612123456789000000155015");

using (var bitmap = new Bitmap(pixelData.Width, pixelData.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb))
{
    using (var ms = new System.IO.MemoryStream())
    {
        var bitmapData = bitmap.LockBits(new Rectangle(0, 0, pixelData.Width, pixelData.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
        try
        {
            // we assume that the row stride of the bitmap is aligned to 4 byte multiplied by the width of the image   
            System.Runtime.InteropServices.Marshal.Copy(pixelData.Pixels, 0, bitmapData.Scan0, pixelData.Pixels.Length);
        }
        finally
        {
            bitmap.UnlockBits(bitmapData);
        }

        // PNG or JPEG or whatever you want
        bitmap.SetResolution(300, 300);
        bitmap.Save(@"C:\Users\user\Desktop\newBarcode.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    }
}

此代码生成此图像

这正是&lt;FNC1&gt;42011111&lt;FNC1&gt;92612123456789000000155015我如何插入和插入 FNC1 值?我尝试使用在此解决方案中找到的“]C1”:

https://github.com/zxing/zxing/issues/475

但它没有工作。任何帮助将不胜感激。

【问题讨论】:

    标签: c# zxing


    【解决方案1】:

    Unicode 字符“\u00f1”而不是“”应该可以工作。

    【讨论】:

    • 老兄....我发誓你是一个该死的天使。几天来我一直在努力想弄清楚这一点,这将被称为迈克尔拯救马可的那一天。谢谢你,朋友。谢谢。
    猜你喜欢
    • 2021-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-13
    • 2023-02-09
    相关资源
    最近更新 更多