Printing Cordova插件打印机崩溃Ionic2应用程序
我正在尝试在应用程序中测试打印功能。我使用的是katzer/cordova插件打印机。 我创建了一个调用打印机的按钮,下面是我编写的代码,不确定是否正确:Printing Cordova插件打印机崩溃Ionic2应用程序,printing,crash,ionic2,cordova-plugins,Printing,Crash,Ionic2,Cordova Plugins,我正在尝试在应用程序中测试打印功能。我使用的是katzer/cordova插件打印机。 我创建了一个调用打印机的按钮,下面是我编写的代码,不确定是否正确: print(){ Printer.isAvailable().then( ()=>{ Printer.print("<h2>This is just a sample!</h2>").then( ()=>alert('Printing successfull'),
print(){
Printer.isAvailable().then(
()=>{
Printer.print("<h2>This is just a sample!</h2>").then(
()=>alert('Printing successfull'),
()=>{alert('Unable to print')}
);
},
(reason)=>{
alert('no printer found');
alert(reason)
});
print(){
Printer.isAvailable()。然后(
()=>{
Printer.print(“这只是一个示例!”),然后(
()=>警报(“打印成功”),
()=>{alert('无法打印')}
);
},
(原因)=>{
警报(“未找到打印机”);
警报(原因)
});
}
我正在使用android手机测试您需要使用文档名应用printoptions
Printer.print("<h2>This is just a sample!</h2>", { name: 'testdoc' })
Printer.print(“这只是一个示例!”,{name:'testdoc'})
什么是错误单击打印按钮后,应用程序崩溃控制台中写入的错误是什么?将手机连接到电脑,打开chrome远程设备,看看。我已经尝试过了,根本不记录任何错误。是的,只需像你说的那样添加打印选项。