我对用于打印 ionic 4 的 ionic native 插件有疑问
I have problem with ionic native plugin for printing ionic 4
当我在 android 设备中 运行 时,此代码也有问题 ios 我有同样的问题
TypeError: Printer.getPlugin(...).check is not a function
at vendor.js:79303
at vendor.js:78443
at new ZoneAwarePromise (polyfills.js:3272)
at tryNativePromise (vendor.js:78442)
at getPromise (vendor.js:78463)
at vendor.js:79301
at Printer.push../node_modules/@ionic-native/printer/ngx/index.js.Printer.check (vendor.js:79308)
at Printer.push../node_modules/@ionic-native/printer/ngx/index.js.Printer.isAvailable (vendor.js:79294)
at SaleInfoPage.push../src/app/paenter code herege/sale-info/sale-info.page.ts.SaleInfoPage.print (main.js:1037)
at Object.eval [as handleEvent] (SaleInfoPage.html:54)
离子信息
离子:
离子 CLI:5.2.1 (/usr/local/lib/node_modules/ionic)
离子框架:@ionic/angular 4.6.0
@angular-devkit/build-angular:0.13.9
@angular-devkit/schematics:7.3.9
@angular/cli:7.3.9
@ionic/angular-工具包:1.5.1
科尔多瓦:
Cordova CLI:8.0.0
科尔多瓦平台:android 8.0.0,ios 4.5.5
Cordova 插件:cordova-plugin-ionic-keyboard 2.1.3,cordova-plugin-ionic-webview 4.1.1,(和其他 9 个插件)
效用:
cordova-res:0.5.0(可用更新:0.5.2)
native-运行:0.2.6(可用更新:0.2.7)
系统:
Android SDK 工具:26.1.1 (/Users/shahab/Library/Android/sdk/)
ios-部署:2.0.0
NodeJS:v8.11.3 (/usr/local/bin/node)
npm:5.6.0
OS : macOS 莫哈韦
Xcode : Xcode 10.2.1 构建版本 10E
函数中的代码
print()
{
this.printer.isAvailable().then(function(){
this.printer.print("https://www.techiediaries.com").then(function(){
alert("printing done successfully !");
},function(){
alert("Error while printing !");
});
}, function(e){
console.log(e);
alert('Error : printing is unavailable on your device ');
});
}
我通过使用相同的库安装这个插件解决了我的问题
isiigoteam/cordova-plugin-printer
当我在 android 设备中 运行 时,此代码也有问题 ios 我有同样的问题
TypeError: Printer.getPlugin(...).check is not a function
at vendor.js:79303
at vendor.js:78443
at new ZoneAwarePromise (polyfills.js:3272)
at tryNativePromise (vendor.js:78442)
at getPromise (vendor.js:78463)
at vendor.js:79301
at Printer.push../node_modules/@ionic-native/printer/ngx/index.js.Printer.check (vendor.js:79308)
at Printer.push../node_modules/@ionic-native/printer/ngx/index.js.Printer.isAvailable (vendor.js:79294)
at SaleInfoPage.push../src/app/paenter code herege/sale-info/sale-info.page.ts.SaleInfoPage.print (main.js:1037)
at Object.eval [as handleEvent] (SaleInfoPage.html:54)
离子信息
离子:
离子 CLI:5.2.1 (/usr/local/lib/node_modules/ionic) 离子框架:@ionic/angular 4.6.0 @angular-devkit/build-angular:0.13.9 @angular-devkit/schematics:7.3.9 @angular/cli:7.3.9 @ionic/angular-工具包:1.5.1
科尔多瓦:
Cordova CLI:8.0.0 科尔多瓦平台:android 8.0.0,ios 4.5.5 Cordova 插件:cordova-plugin-ionic-keyboard 2.1.3,cordova-plugin-ionic-webview 4.1.1,(和其他 9 个插件)
效用:
cordova-res:0.5.0(可用更新:0.5.2) native-运行:0.2.6(可用更新:0.2.7)
系统:
Android SDK 工具:26.1.1 (/Users/shahab/Library/Android/sdk/) ios-部署:2.0.0 NodeJS:v8.11.3 (/usr/local/bin/node) npm:5.6.0 OS : macOS 莫哈韦 Xcode : Xcode 10.2.1 构建版本 10E
函数中的代码
print()
{
this.printer.isAvailable().then(function(){
this.printer.print("https://www.techiediaries.com").then(function(){
alert("printing done successfully !");
},function(){
alert("Error while printing !");
});
}, function(e){
console.log(e);
alert('Error : printing is unavailable on your device ');
});
}
我通过使用相同的库安装这个插件解决了我的问题 isiigoteam/cordova-plugin-printer