printLabel method
Future<PrintResult>
printLabel(
- LabelJob label, {
- String printerName = '',
- TargetPrinter? printer,
- String? html,
- int copies = 1,
A native label; when it cannot be drawn and html is given, the HTML
is printed instead (superprinter_flutter's fallback).
Implementation
Future<PrintResult> printLabel(
LabelJob label, {
String printerName = '',
TargetPrinter? printer,
String? html,
int copies = 1,
}) async {
final invalid = label.validate();
if (invalid != null) return PrintResult.failed(FailReason.unsupported, invalid);
final r = await _run(
printer,
printerName,
sp.PrintJob(type: sp.JobTypes.label, label: sp.LabelJob.parse(label.encode()), copies: copies),
);
if (r.status == JobStatus.printed || html == null || html.isEmpty) return r;
return printHtml(html, printerName: printerName, printer: printer, copies: copies);
}