I’m developing a POS app using the ionic framework with capacitor and angular
ionic version 7.2.0
capacitor version 5.5.1
angular version 17.3.1
I need to be able to print receipts from the app without any user intervention to a toshiba usb remote receipt printer type TRST-A10-SC1-QM-R
So far I was able to print the receipt to a pdf using the cordova-plugin-printer combined with @awesome-cordova-plugins/printer but these plugin require user intervention (print dialog) and in the usb printer is not found
`import { Injectable } from ‘@angular/core’;
import { Printer} from ‘@awesome-cordova-plugins/printer/ngx’;
import { Capacitor } from ‘@capacitor/core’;
@Injectable({
providedIn: ‘root’,
})
export class PrintService {
constructor(
private readonly printer: Printer
) {
}
async printTicket(ticket:string) {
if (Capacitor.isNativePlatform()) {
if (await this.printer.isAvailable()) {
this.printer.print(ticket);
} else {
alert('Printing not available');
}
} else {
window.print();
}
}
}`
Eli Smets is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.