Printer Bluetooth Ionic 3

Cannot use Thai fonts Please help me

So got any error? share what you did, how people can give you answer?

Home.htm

Ionic Blank

The world is your oyster.

If you get lost, the will be your guide.

<button ion-button (click)=“getPrintersList()”>List Devices

Printer Details : {{ printerslist | json }}

Status : {{ status }}

<ion-input type=“text” [(ngModel)]=“feedlines”>


<button ion-button (click)=“connectDevice()” block>Connect Device


<button ion-button (click)=“printText(‘

Hello World ບໍລິສັດ ດີໂພສ ຊອບແວ บอลีสัด สีเพฟด ดา จำกัด compayny

\n Break line \n New Characters \n \n \n \n’)” block>Print

<button ion-button (click)=“provideFeed(feedlines)” full>Feed


<button ion-button (click)=“printBarcode()” full>Print Barcode


<button ion-button (click)=“print2DBarcode()” full>Print 2D Barcode


<button ion-button (click)=“printPage()” full>Print Page


<button ion-button (click)=“printMyImage()” full>Print Image


Home.ts

import { Component } from ‘@angular/core’;
import { IonicPage, NavController, NavParams, AlertController } from ‘ionic-angular’;

import * as iconv from ‘iconv-lite’;

declare let DatecsPrinter:any;
declare var window: any;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {

DatecsPrinter: any;
public printerslist;
public status = “Failure”;
public feedlines:Number = 1;
listBluetoothDevices:any=;
constructor(public navCtrl: NavController,
public navParams: NavParams,
private alertCtrl:AlertController) {
this.getPrintersList();

//this.connectDevice();
//this.printSampleText();

}

listBluetoothDevices1(){
this.listBluetoothDevices=;
return new Promise((resolve, reject) => {
window.DatecsPrinter.listBluetoothDevices(
function (success) {
resolve(success);
},
function (error) {
reject(error);
});
});

}
getPrintersList(){
this.printerslist = ;
this.status = “”;
this.listBluetoothDevices1().then(result => {
this.printerslist = result;
this.status = “Success”;
}).catch(err => {
console.log(“ERROR”,err);
let mno=this.alertCtrl.create({
title:"ERROR "+err,
buttons:[‘Dismiss’]
});
mno.present();
});
}

connectDevice(){
alert(this.printerslist[0].address);
window.DatecsPrinter.connect(this.printerslist[0].address, function (success) {
alert(JSON.stringify(success));
}, function (error) {
alert(JSON.stringify(error));
});
}

printSampleText(){
window.DatecsPrinter.printSelfTest( function (success) {
alert(JSON.stringify(success));
}, function (error) {
alert(‘Error’);
});
}

public printText(text, charset = ‘UTF-8’){
alert(text);
window.DatecsPrinter.printText(text, charset, function (success) {
alert(JSON.stringify(success));
}, function (error) {
alert(“error”);
});
}

provideFeed(lines){
alert(lines)
window.DatecsPrinter.feedPaper( lines, function (success) {
alert(JSON.stringify(success));
}, function (error) {
alert(JSON.stringify(error));
});
}

getStatus(){
window.DatecsPrinter.getStatus( function (success) {
alert(JSON.stringify(success));
}, function (error) {
alert(JSON.stringify(error));
});
}

printBarcode(data = ‘1234445775’, type = 73 ){
window.DatecsPrinter.printBarcode( type, data, function (success) {
this.provideFeed(100);
alert(JSON.stringify(success));
}, function (error) {
alert(JSON.stringify(error));
});
}

print2DBarcode(data = ‘PDF1234445775417’, type = 74 ){
window.DatecsPrinter.printBarcode( type, data, function (success) {
this.provideFeed(100);
alert(JSON.stringify(success));
}, function (error) {
alert(JSON.stringify(error));
});
}

public printPage(){
window.DatecsPrinter.printPage( function (success) {
alert(JSON.stringify(success));
}, function (error) {
alert(JSON.stringify(error));
});
}

printMyImage() {
var image = new Image();
image.src = ‘assets/imgs/logo.jpeg’;
image.onload = function() {
var canvas = document.createElement(‘canvas’);
canvas.height = 150;
canvas.width = 200;
var context = canvas.getContext(‘2d’);
context.drawImage(image, 0, 0);
var imageData = canvas.toDataURL(‘image/jpeg’).replace(/^data:image/(png|jpg|jpeg);base64,/, “”); //remove mimetype
window.DatecsPrinter.printImage(
imageData, //base64
canvas.width,
canvas.height,
1,
function(success) {
alert(JSON.stringify(success));
this.printBarcode();
this.provideFeed();
},
function(error) {
alert(JSON.stringify(error));
}
)};
}

}

Cannot use Thai fonts Please help me