你可以在C#中使用以下函数从一个流(TIF/JPG或PDF)中读取条形码,将流转换为字节数组。
private static byte[] StreamToByteArray(Stream input){ byte[] buffer = new byte[16 * 1024]; using (MemoryStream ms = new MemoryStream()) { int read; while ((read = input.Read(buffer, 0, buffer.Length)) > 0) { ms.Write(buffer, 0, read); } return ms.ToArray(); }}
在SoftekBarcode中您可以用以下代码实现:
SoftekBarcodeNet.BarcodeReader barcode = new SoftekBarcodeNet.BarcodeReader();byte[] data = StreamToByteArray(s);int nBarCodes = barcode.ScanBarCodeFromByteArray(data)。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!