(Ionic 2)
The plugin located here seems to not work for me on android and ios : http://ionicframework.com/docs/native/printer/
I think that I followed the guidelines from this page, the code is building on both platforms but I got a black screen on ios and a blank one on android when emulate ...
First I started a new project : ionic start PrinterApp --v2
Then I installed platforms : android 6.2.1, ios 4.3.1
Then the two command lines from the plugin page :
ionic plugin add --save de.appplant.cordova.plugin.printer
npm install --save @ionic-native/printer
Then in the home.html I put a line to active the printer :
<button class="button" (click)="print()">Print</button>
And finally my home.ts looks like this :
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Printer, PrintOptions } from '@ionic-native/printer';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController, private printer: Printer) {
}
print() {
this.printer.isAvailable();
let options: PrintOptions = {
name: 'MyDocument',
duplex: true,
landscape: true,
grayscale: true
};
this.printer.print("http://google.com", options);
}
}
Did anyone have this kind of troubles with the plugin ? Did I do something wrong ? Should I install other things to fix the problem ?
And did anyone have a exemple project working well ?
Thank you very much !
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…