I want to show QR-code and Codabar code both.
This is my code.
var qrcodeWriter = new ZXing.Mobile.BarcodeWriter {
Format = ZXing.BarcodeFormat.QR_CODE,
Options = new ZXing.Common.EncodingOptions {
Width = 400,
Height = 400,
Margin = 1
}
};
var qrcode = qrcodeWriter.Write (order.order_number);
imageQR.Image = qrcode;
var barcodeWriter = new ZXing.Mobile.BarcodeWriter {
Format = ZXing.BarcodeFormat.CODABAR,
Options = new ZXing.Common.EncodingOptions {
Width = 400,
Height = 80,
Margin = 1
}
};
var barcode = barcodeWriter.Write (order.order_number);
imageBar.Image = barcode;
QR-code success but codabar failed at barcodeWriter.write function.
Please help me.
Error Code:
ex {System.ArgumentException: Cannot encode : 'T' at ZXing.OneD.CodaBarWriter.encode (System.String co…} System.ArgumentException
Call Stacks:
MasterBee.HistoryDetailViewController.ViewDidLoad() in /Volumes/Untitled/MsterBee_TEMP/MasterBee/ViewControllers/History/HistoryDetailViewController.cs:69
UIKit.UIApplication.UIApplicationMain() in UIKit.UIApplication.Main(string[] args, System.IntPtr principal, System.IntPtr delegate) in /Users/builder/data/lanes/3339/39ebb778/source/maccore/src/UIKit/UIApplication.cs:79
UIKit.UIApplication.Main(string[] args, string principalClassName, string delegateClassName) in /Users/builder/data/lanes/3339/39ebb778/source/maccore/src/UIKit/UIApplication.cs:63
MasterBee.Application.Main(string[] args) in /Volumes/Untitled/MsterBee_TEMP/MasterBee/Main.cs:15
I find reason.
It was format of CODABAR.
Barcodes have each different formats.
So if you make CODABAR with QRcode's format text then it crash.
Additionally, CODE_128 and QRcode's format are same.