【发布时间】:2017-05-24 18:57:51
【问题描述】:
我试图在我的 ZXing 条形码中放置 <FNC1> 分隔符,我不确定这些应该如何格式化为字符串值。我有
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);
}
}
这正是<FNC1>42011111<FNC1>92612123456789000000155015我如何插入和插入 FNC1 值?我尝试使用在此解决方案中找到的“]C1”:
https://github.com/zxing/zxing/issues/475
但它没有工作。任何帮助将不胜感激。
【问题讨论】: