ERROR_WRONG_LABEL when trying to print wireless using Android Brother Sdk for label printer
I resolved this by creating a LabelInfo
object, since you have a Label Printer. It's not clear at all in the documentation. You need to set the label info after the printer info.
PrinterInfo info = myPrinter.getPrinterInfo();
info.paperSize = PrinterInfo.PaperSize.CUSTOM;
LabelInfo mLabelInfo = new LabelInfo();
mLabelInfo.labelNameIndex = 5;
mLabelInfo.isAutoCut = true;
mLabelInfo.isEndCut = true;
mLabelInfo.isHalfCut = false;
mLabelInfo.isSpecialTape = false;
myPrinter.setPrinterInfo(info);
myPrinter.setLabelInfo(mLabelInfo);
The ERROR_WRONG_LABEL
means that you have a wrong value in paperSize
or labelNameIndex
.
I have a P750W label printer with a 24'' paper. I found that value 5
is the good one for this size, but I don't know for your printer.
I had the same problem and figured out that you should specify the labelNameIndex
field to the PrinterInfo
object.
I had the QL-810W
printer. I tried many values and nothing worked until I set it to:
printerInfo.labelNameIndex = LabelInfo.QL700.W62RB.ordinal // -> 17
I figured out the correct value by making a for loop with all integers from 0 to 100 and logging the result until the printing succeeded with this value. I know this is not the optimal solution but I can't find any documentation or reference for these codes.
Here is the code I used to specify the PrinterInfo object:
val printerInfo = PrinterInfo()
printerInfo.printerModel = PrinterInfo.Model.QL_810W
printerInfo.port = PrinterInfo.Port.NET
printerInfo.orientation = PrinterInfo.Orientation.PORTRAIT
printerInfo.paperSize = PrinterInfo.PaperSize.CUSTOM
printerInfo.align = PrinterInfo.Align.CENTER
printerInfo.valign = PrinterInfo.VAlign.MIDDLE
printerInfo.printMode = PrinterInfo.PrintMode.ORIGINAL
printerInfo.numberOfCopies = 1
printerInfo.labelNameIndex = LabelInfo.QL700.W62RB.ordinal // -> 17
printerInfo.isAutoCut = true
printerInfo.isCutAtEnd = false
return printerInfo