Ionic 2 print logo via blutooth on small thermal printer?


#1

I have a small blutooth printer. i want to print sales receipt on this printer with logo image via app. How to do that?


#2

One of https://ionicframework.com/docs/native/bluetooth-serial/ or https://ionicframework.com/docs/native/ble/ probably. Maybe also just https://ionicframework.com/docs/native/printer/


#3

i tried bluetooth-serial.
It can print string . I want to print logo also. How to use this plugin to print logo? @richardshergold can you please help us?

 testPrint(address)
  {
    let printData="<img src=assets/img/logo.png> \n\n    Test hello this is a test \n\n\n\n Hello Test 123 123 123\n\n\n"

    
    let xyz=this.connectBT(address).subscribe(data=>{
      this.btSerial.write(printData).then(dataz=>{
        console.log("WRITE SUCCESS",dataz);

        let mno=this.alertCtrl.create({
          title:"Print SUCCESS!",
          buttons:['Dismiss']
        });
        mno.present();

        xyz.unsubscribe();
      },errx=>{
        console.log("WRITE FAILED",errx);
        let mno=this.alertCtrl.create({
          title:"ERROR "+errx,
          buttons:['Dismiss']
        });
        mno.present();
      });
      },err=>{
        console.log("CONNECTION ERROR",err);
        let mno=this.alertCtrl.create({
          title:"ERROR "+err,
          buttons:['Dismiss']
        });
        mno.present();
      });

  }

#4

did u already know how to print image using bluetooth-serial?


#5

You can try using the plugin DatecsPrinter.