【问题标题】:Ionic native Printer plugin not working. Does printer plugin need special initialization step?离子本机打印机插件不起作用。打印机插件是否需要特殊的初始化步骤?
【发布时间】:2020-02-07 19:36:18
【问题描述】:

我已经查看过其他人之前发布的相同问题 (Ionic native Printer plugin not working),但我已经完成了那里提到的所有操作,但仍然无法正常工作。它总是说设备上的拣选/打印不可用。

this.printer.pick().then(function() {
    alert("Picking printer done successfully !");
}, function() {
    alert('Error : picking printer unavailable on your device ');
});

this.printer.isAvailable().then(function() {
    this.printer.print(page, options).then(function() {
        alert("printing done successfully !");
    }, function() {
        alert("Error while printing !");
    });
}, function() {
    alert('Error : printing is unavailable on your device ');
});

【问题讨论】:

    标签: cordova plugins printing


    【解决方案1】:

    避免在另一个函数中使用“function()”。试试这个

    this.printer.pick().then(pickSuccess => {
        alert("Picking printer done successfully !");
    }, pickError => {
        alert('Error : picking printer unavailable on your device ');
    });
    
    this.printer.isAvailable().then(isAvailableSuccess => {
        this.printer.print(page, options).then(printSuccess => {
            alert("printing done successfully !");
        }, printError => {
            alert("Error while printing !");
        });
    }, isAvailableError => {
        alert('Error : printing is unavailable on your device ');
    });
    

    【讨论】:

      猜你喜欢
      • 2017-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多