createPrintJob method
Einen Druckjob anlegen. logo ist das fertige Rasterbild
(loadPrintLogo), der Server dekodiert keine Bilder. brandMark druckt
das Kasseneck-Logo am Ende (am Draht brand). source ist Freitext,
bekannt sind printJobSources.
Implementation
Future<PrintJob> createPrintJob({
required String printerId,
required ReceiptLayout layout,
String? receiptId,
String? title,
String? source,
PrintLogo? logo,
bool brandMark = false,
}) async {
const name = Aufrufe.createPrintJob;
if (printerId.trim().isEmpty) {
throw const KasseneckValidationError(name, 'printerId fehlt', 'request');
}
final daten = await transport.call(name, params: {
'printerId': printerId,
'layout': layout.toJson(),
if (receiptId != null && receiptId.isNotEmpty) 'receiptId': receiptId,
if (title != null && title.isNotEmpty) 'title': title,
if (source != null && source.isNotEmpty) 'source': source,
if (logo != null)
'logo': {
'scale': logo.size.code,
'pxWidth': logo.pixelWidth,
'pxHeight': logo.pixelHeight,
'width': logo.raster.width,
'height': logo.raster.height,
'rows': rasterRowsBase64(logo),
},
if (brandMark) 'brand': true,
});
// Ohne Kennung kann niemand den Job abfragen; ein leerer Text wäre ein
// angeblich angelegter Job, und der Kassier druckte ein zweites Mal.
return PrintJob(jobId: _jobId(name, daten), status: _status(daten['status']));
}