ERROR_WRONG_LABEL when trying to print a wireless network using Android Brother Sdk for a label printer

I am trying to print using tags from my Android application that uses the wifi commands of the Brother QL-720NW Label Printer . Since I was performing factory reset on the printer, I get this error

Problem: ERROR_WRONG_LABEL (means the wrong movie specified in the sdk manual), the error was selected in the print command, since I performed factory reset on the printer.

CODE:

void printTemplateSample() 
    {
        Printer myPrinter = new Printer();
        PrinterInfo myPrinterInfo = new PrinterInfo();

        try{
            // Retrieve printer informations
            myPrinterInfo = myPrinter.getPrinterInfo();

            // Set printer informations
            myPrinterInfo.printerModel = PrinterInfo.Model.QL_720NW;
            myPrinterInfo.port=PrinterInfo.Port.NET;
            myPrinterInfo.printMode=PrinterInfo.PrintMode.FIT_TO_PAGE;
//                  :
            myPrinterInfo.paperSize = PrinterInfo.PaperSize.A4;


            myPrinterInfo.ipAddress="192.168.1.13";
            myPrinterInfo.macAddress="00:80:92:BD:35:7D";


            myPrinter.setPrinterInfo(myPrinterInfo);

            // Start creating P-touch Template command print data
//          myPrinter.startPTTPrint(1, null);
           Boolean val= myPrinter.startPTTPrint(6, null);
            Log.i("print", "startPTTPrint "+val);

            // Replace text
            myPrinter.replaceText("abcde");
//          myPrinter.replaceText("12345");

            // Trasmit P-touch Template command print data
            PrinterStatus status=myPrinter.flushPTTPrint();//ERROR thrown here
            Log.i("print", "PrinterStatus  err"+status.errorCode);

        }catch(Exception e){    
            e.printStackTrace();
        }
    }
  • I use there sample code from here
  • The goal is my ultimate goal - to replace the text in the template and print, but at the moment I can not print anything
  • I am using this Brother SDK.
  • ,
  • Ptouch - .

, !

+4
1

, LabelInfo, . . .

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);

ERROR_WRONG_LABEL , paperSize labelNameIndex. P750W 24- . , 5 , .

+3

Source: https://habr.com/ru/post/1534633/


All Articles