ebanutsya

This commit is contained in:
2023-10-29 06:54:42 +03:00
parent 0bc1835405
commit cd89a70b17
15 changed files with 346 additions and 88 deletions

View File

@@ -17,16 +17,16 @@ class PrintingService {
this.port = port;
}
private async print(printer: string, type: string, bytes: Uint8Array): Promise<string> {
private async print(printer: string, type: string, bytes: Uint8Array): Promise<boolean> {
let response = await axios.post(`http://${this.apiUrl}:${this.port}/print/${printer}/${type}`, bytes.buffer);
return response.data;
return response.data.ok;
}
public async printPdf(printer: string, pdfBytes: Uint8Array): Promise<string> {
public async printPdf(printer: string, pdfBytes: Uint8Array): Promise<boolean> {
return this.print(printer, "pdf", pdfBytes);
}
public async printImage(printer: string, imageBytes: Uint8Array): Promise<string> {
public async printImage(printer: string, imageBytes: Uint8Array): Promise<boolean> {
return this.print(printer, "image", imageBytes);
}
}