'Ionic - my thermal printer not response after send data using bluetooth
import { BluetoothSerial } from '@awesome-cordova-plugins/bluetooth-serial/ngx';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
MAC = 'DC:0D:30:12:11:15'; // this is bluetooth printer mac address
constructor(private bluetoothSerial: BluetoothSerial) {}
print() {
var data = new Uint8Array([0x0A, 0x0A, 0x0A]);
// send byte code into the printer
this.bluetoothSerial.connect(this.MAC).subscribe(() => {
this.bluetoothSerial.write(data)
.then(() => {
console.log('Print success');
console.log(this.MAC);
this.bluetoothSerial.disconnect();
console.log(data)
})
.catch((err) => {
console.error(err);
});
});
}
the code is the example of .ts file to make the esc/pos data send to printer
the console output are success but my thermal printer print nothing printer type : xprinter xp-460b ionic ver: 5.4.16 angular ver: 13.0.4
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|