Ionic printer issue

Hi can any one help me please. I have issue related to ionic printer plugin.

so my home.html is

<ion-content padding>
 <button (click)="print()">Print</button>

and my home.ts is

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Printer, PrintOptions } from '@ionic-native/printer';
  selector: 'page-home',
  templateUrl: 'home.html'
export class HomePage {

  constructor(public navCtrl: NavController,private printer: Printer) {
this.printer.isAvailable().then(this.onSuccessLoad, this.onErrorLoad);

let options: PrintOptions = {
name: 'MyDocument',
printerId: 'My Printer XYZ',
duplex: true,
landscape: true,
grayscale: true



alert('Error : printing is unavailable on your device ');

alert("printing done successfully !");

alert("Error while printing !");


i have added printer in provider also in app.module.ts

so when app get loaded I get print button so when i click on it call print() method.
in print method i have
this.printer.isAvailable().then(this.onSuccessLoad, this.onErrorLoad);
it calls this.onErrorLoad method.It means printer is not available.
my onErrorLoad method is

alert('Error : printing is unavailable on your device ');

i want it should call this.onSuccessLoad.
please help me to make printer available so that this.onSuccessLoad can run.


What platform and device are you testing on?
What is your ionic info output?
Are you sure the platform is ready when you click the button?

Hi Sujan
Thanks for your help i was running app on emulator. But when i run the command ionic cordova run android then it worked fine.

Thank you very much.

1 Like