Nativescript Brother Printer SDK无法打印标签错误标签IOS

Nativescript Brother Printer SDK无法打印标签错误标签IOS,nativescript,nativescript-vue,brother-print-sdk,Nativescript,Nativescript Vue,Brother Print Sdk,我正在尝试从IOS的Nativescript+Vue应用程序打印标签。我可以成功连接到打印机,但当我尝试打印图像时,它会给我一个错误。我使用的打印机是“QL-810W”。我加载的标签是62毫米卷(没有设定长度),可以支持红色和黑色 以下是相关代码: exports.BrotherPrinterClass = BrotherPrinterClass; var BrotherPrinter = (function () { function BrotherPrinter() { }

我正在尝试从IOS的Nativescript+Vue应用程序打印标签。我可以成功连接到打印机,但当我尝试打印图像时,它会给我一个错误。我使用的打印机是“QL-810W”。我加载的标签是62毫米卷(没有设定长度),可以支持红色和黑色

以下是相关代码:

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);
        }
    };
然后返回与
error\u error\u LABEL\u
相关的错误“-41”。我尝试了调整所有属性,也尝试了
settings.strPaperName=“62mm”
,但没有返回任何不同的结果

传入的图像是ImageSource类型的,我还尝试了以下行,
let errorCode=printer.printImageCopy(image.ios,1)。这将返回一个与
error\u NONE\u
相关的错误代码0,但不会输出任何内容。据我所知,这不是SDK想要的CGImage

我可以使用“iPrint&Label”应用程序在iPad上打印。只是不是来自SDK

编辑: 我尝试使用
printFilesCopy()
从文件打印。当我开始打印时,这不会返回任何错误,但不会打印任何内容。此外,我可能设置不正确(例如,将
'62mmRB'
更改为
'102mm'
),或者我无法通过注释掉
打印机.setPrintInfo(设置)
行来设置设置。这些更改不会影响结果


此外,我还购买了一个62毫米纯黑色卷,并尝试了一下,结果发现我也有同样的问题。

我看到供应商随SDK提供了一个示例应用程序。您是否尝试运行示例应用程序,但在打印图像时仍然看到相同的问题?您好,感谢您的回复。是的,我能够运行示例应用程序,而且它似乎打印得很好。那么你肯定错过了什么。试着比较一下代码,你有他们示例项目的链接吗?嘿,我有他们示例项目的链接,尽管它是在Objective-C中完成的,而不是nativescript。我使用的是3.1.12版。我快速浏览并使用了该应用程序,但我对objective cI了解不多,我很清楚它是objective c,您应该参考NativeScript编组文档来理解这里的JS翻译。我一有空就去看看。