CodeMinion / another_brother

Another Brother Flutter SDK
BSD 3-Clause "New" or "Revised" License
21 stars 21 forks source link

QL 820NWB ERROR_WRONG_LABEL #83

Closed dustin-auby closed 4 months ago

dustin-auby commented 7 months ago

Hi,

im trying to print to a QL 820NWB printer. the printer is discovered but when i try and print to it i get this error

errorCode: {name: ERROR_WRONG_LABEL, id: -1}

any suggestions on what i should change ?

dustin-auby commented 7 months ago

var printer = brother.Printer(); var printInfo = brother.PrinterInfo(); printInfo.printerModel = brother.Model.QL_820NWB; printInfo.printMode = brother.PrintMode.FIT_TO_PAGE; printInfo.isAutoCut = true; printInfo.port = brother.Port.NET; // Set the label type. double width = 100.0; double rightMargin = 0.0; double leftMargin = 0.0; double topMargin = 0.0; CustomPaperInfo customPaperInfo = CustomPaperInfo.newCustomRollPaper(printInfo.printerModel, Unit.Mm, width, rightMargin, leftMargin, topMargin); printInfo.customPaperInfo = customPaperInfo; printInfo.ipAddress = "10.0.2.158"; // printInfo.paperSize = brother.PaperSize.CUSTOM; await printer.setPrinterInfo(printInfo);

askankit commented 6 months ago

have you found any solution?

dustin-auby commented 6 months ago

have you found any solution?

Hi, No i have not. i have ended up not printing via the sdk and using the android print service, this is not good though as it prompts the user each time to confirm printing

CodeMinion commented 6 months ago

Hi @dustin-auby ,

Thanks for reaching out about this and apologies for the delayed reply.

The error you are seeing comes from using a CustomPaperInfo to specify the label. In the case of the QL-* printers the label is instead specified using the respective QL paper. You may find a sample printing to the QL-1110NWB here https://github.com/CodeMinion/Demo-Another-Brother-Prime/blob/master/lib/main.dart#L432

CodeLab: https://codelabs.rouninlabs.com/codelabs/another_brother-codelab/index.html?index=..%2F..index#4

The form for the QL-820NWB you have will be the same but use Model.QL_820NWB and the label will come from the QL700 label set (https://github.com/CodeMinion/another_brother/blob/main/lib/label_info.dart#L419) as there is no QL800 set in the SDK as of yet.

Hope it helps, but please don't hesitate to reach out if there is anything else we I can help with,