0
抵达ERROR_WRONG_LABEL我一直在试图让我的Android代码打印到一个新的Brother打印机,但我一直在Brother打印机QL-710W
我不断收到ERROR_WRONG_LABEL。
我也得到了信息:
D/Brother Print SDK: no such enum object for the id: -1
这是我的代码:
public void printLabel() {
Printer myPrinter = new Printer();
PrinterInfo myPrinterInfo = new PrinterInfo();
try {
myPrinterInfo.printerModel = PrinterInfo.Model.QL_710W;
myPrinterInfo.ipAddress = "12.1.3.45";//not real ip
myPrinterInfo.macAddress = "";
myPrinterInfo.port = PrinterInfo.Port.NET;
myPrinterInfo.paperSize = PrinterInfo.PaperSize.A7;
myPrinterInfo.printMode=PrinterInfo.PrintMode.FIT_TO_PAGE;
myPrinterInfo.numberOfCopies = 1;
LabelInfo mLabelInfo = new LabelInfo();
mLabelInfo.labelNameIndex = 5;
mLabelInfo.isAutoCut = true;
mLabelInfo.isEndCut = true;
mLabelInfo.isHalfCut = false;
mLabelInfo.isSpecialTape = false;
myPrinter.setPrinterInfo(myPrinterInfo);
myPrinter.setLabelInfo(mLabelInfo);
//File downloadFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
Log.i("HEYYYY", "startCommunication = " + myPrinter.startCommunication());
Bitmap map = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_overflow);
PrinterStatus printerStatus = myPrinter.printImage(map);
Log.i("HEYYYY", "errorCode-11 = " + printerStatus.errorCode);
Log.i("HEYYYY", "labelWidth = " + myPrinter.getLabelParam().labelWidth);
Log.i("HEYYYY", "paperWidth = " + myPrinter.getLabelParam().paperWidth);
Log.i("HEYYYY", "labelNameIndex " + mLabelInfo.labelNameIndex);
Log.i("HEYYYY", "printers " + myPrinter.getNetPrinters("QL-710W"));
Log.i("Label-id", myPrinter.getPrinterStatus().labelId + "");
myPrinter.endCommunication();
} catch(Exception e){
e.printStackTrace();
}
}
每当我把我从打印机页面得到的mac地址,错误代码变为
ERROR_NOT_MATCH_ADDRESS.
但没有它(将其设置为空字符串或注释掉),它将更改为
ERROR_WRONG_LABEL
。
请问这段代码有什么问题?
UPDATE:
我插入正确的MAC ID和现在的错误代码是
ERROR_WRONG_LABEL
我该怎么办?
你可以参考这个答案http://stackoverflow.com/questions/22808548/error-wrong-label-when-trying-to-print-wireless-using-android-brother-sdk-for-la –
它没有为我工作......我到底应该提到什么? – gbenroscience