Brother Printer SDK cannot print label ERROR_WRONG_LABEL_ IOS

0

I am trying to print a label from my Nativescript+Vue application for IOS. I can successfully connect to printer, however when I try to print an image, it will give me an Error. The printer I am using is the "QL-810W". The label that I have loaded is the 62mm roll (no set length) and can support both red and black.

Here is the surrounding code:

exports.BrotherPrinterClass = BrotherPrinterClass;

var BrotherPrinter = (function () {
    function BrotherPrinter() {
    }

    BrotherPrinter.prototype.print_image = function (PrinterName, ipAddress, image) {

        try {
            let printer = new BRPtouchPrinter()
            printer.printerName = PrinterName
            printer.interface = CONNECTION_TYPE_WLAN
            printer.setIPAddress(ipAddress)

            let settings = new BRPtouchPrintInfo()
            settings.strPaperName = "62mmRB"
            settings.nPrintMode = 0x03 //PRINT_FIT_TO_PAGE
            settings.nAutoCutFlag = 0x00000001 //OPTION_AUTOCUT
            settings.nOrientation = 0x00 //ORI_LANDSCAPE
            settings.nHorizontalAlign = 0x01 //ALIGN_CENTER
            settings.nVerticalAlign = 0x01 //ALIGN_MIDDLE
            printer.setPrintInfo(settings)

            if (printer.startCommunication()) {
                //Print to the printer
                let errorCode = printer.printImageCopy(image.ios.CGImage, 1);
                if (errorCode != 0)
                    console.log("ERROR - ", errorCode)
                }
                printer.endCommunication()
            }
            else{
                console.log("Failed to connect")
            }   
        }
        catch(e) {
            console.log("Error - ", e);
        }
    };

This then returns the error "-41" which correlates to ERROR_WRONG_LABEL_. I've tried adjusting all properties, I've also tried settings.strPaperName = "62mm" and that didn't return anything different.

The image that is been passed in is of an ImageSource type, and I've also tried the following line, let errorCode = printer.printImageCopy(image.ios, 1);. This returns an error code of 0 which correlates to ERROR_NONE_ But nothing gets printed out. And as far as I know, this isn't a CGImage like the SDK wants.

I can print from an iPad using the "iPrint&Label" app. Just not from the SDK

EDIT: I have tried to print from a file using printFilesCopy(). This returns no error when I go to print, but nothing gets printed. Additionally, I can set the settings incorrectly (eg, change '62mmRB' for '102mm') or I can outright not set the settings by commenting out the printer.setPrintInfo(settings) line. These changes do not impact the result.

Furthermore, I have purchased a 62mm black only roll, and tried that, only to find that I have the exact same issue.

nativescript
nativescript-vue
asked on Stack Overflow Nov 15, 2019 by matty0005 • edited Nov 22, 2019 by matty0005

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0