cordova-plugin-printer icon indicating copy to clipboard operation
cordova-plugin-printer copied to clipboard

Object doesn't support property or method 'CHECK'

Open afzal415 opened this issue 6 years ago • 4 comments

When trying to print in windows application getting the error 'Object doesn't support property or method 'chcek''

this issue does not appear version 0.7.3

cli packages: (C:\Users\hi\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : not installed

local packages:

@ionic/app-scripts : 3.2.1
Cordova Platforms  : windows 5.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v8.14.1
npm  : 6.5.0
OS   : Windows 10

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

afzal415 avatar Mar 17 '19 09:03 afzal415

Can you please provide a code snippet and are you using any plugin wrapper provided by Ionic?

katzer avatar Mar 19 '19 13:03 katzer

My typescript

public print(){
  this.printer.isAvailable()
  .then(success => {
    let receiptno = 1603001;
    let header = '<h3>Receipt No : ' +receiptno + '\t\tTable No : ' + this.tblno +'</h3>'
    let shop = '<p> Testing SHop </p> <br/> No 3 , Mohamed pura <br/> Salem <br/>'
    let datafull = header + '<br/>' + shop
    this.printer.print(datafull)
    .then(data => {
        console.log('printing done successfully')
    })
  })
  .catch(data => {
    console.log('printer error ',data)
    console.log('printer not available')
  })

my html file

<ion-col >
      <button class="foot" ion-button icon-right (click)="print()" >
      <ion-icon name="print">PRINT</ion-icon>
    </button>
  </ion-col>

sorry can let me know which kind of plugin wrapper

afzal415 avatar Mar 20 '19 11:03 afzal415

The issue is that you are using the Ionic wrapper which is made for cordova-plugin-printer v0.7.x but under the hood you're using v0.8. For example there's no isAvailable method anymore.

katzer avatar Mar 21 '19 09:03 katzer

I tried updated the plugin to version 0.8 . Below is my code. I am not able to use the options. Below is my code

public print(){
  var options = {
    monochrome: true
  }
     let receiptno = 1603001;
     let header = '<h3>Receipt No : ' +receiptno + '\t\tTable No : ' + this.tblno +'</h3>'
     let shop = '<p> Testing SHop </p> <br/>strreet 1  <br/> OS <br/>'
     let datafull = header + '<br/>' + shop
    .then(data => {
        console.log('printing done successfully')
    })
  .catch(data => {
    console.log('printer error ',data)
    console.log('printer not available')
    this.common.showLoading()
    this.common.showError(data)
  })
}

I am getting the below error

Type '{ monochrome: boolean; }' has no properties in common with type 'PrintOptions'.

I tried uninstalling the plugin and installed the new version. Still i am getting only the PICK,CHECK,ISAVAILABLE and PIRNT sub modules under printer plugin.

my congif file show versio 0.8 <plugin name="cordova-plugin-printer" spec="^0.8.0" />

afzal415 avatar Mar 24 '19 12:03 afzal415