cordova 打印机插件不打印 t
cordova printer plugin is not printing t
我正在尝试从我的 cordova 应用程序打印 html 文件。
我已经安装了 cordova-plugin-printer。
在 app.module.ts 文件中导入插件,然后当我尝试使用 this.printer.print('hello')
根本不会注意到
从“@ionic-native/printer/ngx”导入{打印机、PrintOptions};
私人打印机:打印机
Print(){
console.log("Print Pressed");
var options = {
font: {
size: 22,
italic: true,
align: 'center'
},
header: {
height: '6cm',
label: {
text: "\n\nDie Freuden",
font: {
bold: true,
size: 37,
align: 'center'
}
}
},
footer: {
height: '4cm',
label: {
text: 'Johann Wolfgang von Goethe, 1749-1832, deutscher Dichter, Naturforscher',
font: { align: 'center' }
}
}
};
this.printer.print("hello",options);
console.log("Print Pressed>>>");
}
尝试:
Print(){
let options: PrintOptions = {
name: 'MyDocument',
printerId: 'printer007',
duplex: true,
landscape: true,
grayscale: true
};
//Checks whether the device is capable of printing
this.printer.isAvailable().then(()=>{
console.log("printer available")
}).catch((error)=>{
console.log("printer not available"+error);
});
}
我正在尝试从我的 cordova 应用程序打印 html 文件。 我已经安装了 cordova-plugin-printer。 在 app.module.ts 文件中导入插件,然后当我尝试使用 this.printer.print('hello') 根本不会注意到
从“@ionic-native/printer/ngx”导入{打印机、PrintOptions};
私人打印机:打印机
Print(){
console.log("Print Pressed");
var options = {
font: {
size: 22,
italic: true,
align: 'center'
},
header: {
height: '6cm',
label: {
text: "\n\nDie Freuden",
font: {
bold: true,
size: 37,
align: 'center'
}
}
},
footer: {
height: '4cm',
label: {
text: 'Johann Wolfgang von Goethe, 1749-1832, deutscher Dichter, Naturforscher',
font: { align: 'center' }
}
}
};
this.printer.print("hello",options);
console.log("Print Pressed>>>");
}
尝试:
Print(){
let options: PrintOptions = {
name: 'MyDocument',
printerId: 'printer007',
duplex: true,
landscape: true,
grayscale: true
};
//Checks whether the device is capable of printing
this.printer.isAvailable().then(()=>{
console.log("printer available")
}).catch((error)=>{
console.log("printer not available"+error);
});
}